This module provides Prof. Arne Andersson's General Balanced Trees. These have no storage overhead compared to unbalanced binary trees, and their performance is better than AVL trees.
This module considers two keys as different if and only if
they do not compare equal (
Trees and iterators are built using opaque data structures that should not be pattern-matched from outside this module.
There is no attempt to balance trees after deletions. As deletions do not increase the height of a tree, this should be OK.
The original balance condition h(T) <= ceil(c * log(|T|)) has been changed to the similar (but not quite equivalent) condition 2 ^ h(T) <= |T| ^ c. This should also be OK.
A general balanced tree.
A general balanced tree iterator.
Rebalances
Removes the node with key
Removes the node with key
Returns a value
Returns a value
Returns a new empty tree.
Inserts
Turns an ordered list
Retrieves the value stored with
Inserts
Returns
Returns
Returns an iterator that can be used for traversing the
entries of
Returns an iterator that can be used for traversing the
entries of
Returns the keys in
Returns
Looks up
Maps function F(
Returns
Returns the number of nodes in
Returns
Returns
Returns
Converts a tree into an ordered list of key-value tuples.
Updates
Returns the values in