Documentation ¶
Overview ¶
an AVL balanced tree with the addition of parent pointers to allow iteration through the nodes
Note: an individual tree is not thread safe, so either access only
in a single go routine or use mutex/rwmutex to restrict access.
The base algorithm was described in an old book by Niklaus Wirth called Algorithms + Data Structures = Programs.
This version allows for data associated with key, which can be overwritten by an insert with the same key. Also delete no does not copy data around so that previous nodes can be deleted during iteration.
Index ¶
- type Node
- type Tree
- func (tree *Tree) CheckUp() bool
- func (tree *Tree) Count() int
- func (tree *Tree) Delete(key item) interface{}
- func (tree *Tree) First() *Node
- func (tree *Tree) Insert(key item, value interface{}) bool
- func (tree *Tree) IsEmpty() bool
- func (tree *Tree) Last() *Node
- func (tree *Tree) Print(printData bool) int
- func (tree *Tree) Search(key item) *Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
a node in the tree
func (*Node) Next ¶
given a node, return the node with the next highest key value or nil if no more nodes.
Click to show internal directories.
Click to hide internal directories.