Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Tree ¶
type Tree[K cmp.Ordered, V any] interface { // Each traverses the tree in order and calls the given function for each node. Each(func(K, V) bool) // Insert inserts a key-value pair and returns the previous value if it exists. Insert(K, V) V // Delete removes a node with the given key from the AVL tree. Delete(K) bool // Pop removes a node with the given key from the AVL tree and returns the value. Pop(K) (V, bool) // Find returns the value associated with the given key. Find(K) (V, bool) // RootKeyValue returns the key and value of the root node. RootKeyValue() (K, V, bool) // Length returns the length of the tree. Length() int // Height returns the height of the tree. Height() int // Clear removes all nodes from the tree. Clear() // Empty returns true if the tree is empty. Empty() bool // Clone returns a copy of the tree. Clone() Tree[K, V] }
Tree represents an AVL tree.
Click to show internal directories.
Click to hide internal directories.