comp • gb.data • avltree

AvlTree (gb.data)

An AVL tree is a self-balancing binary search tree. This means that we can guarantee insertion, removal and retrieval of data in O(log n) time, no matter what data you have in the tree. Its interface is similar to that of a Collection.

This class is
Create a new, empty AvlTree.
creatable
.
This class acts like a
Return the value associated with the given key. If no node with this key was found, Null is returned.
read
/
Creates a new node with the given key and value or changes the value of an already existing key. If the value is Null, then the node is removed.
write
array.
This class is
Visit each element of the tree in-order, i.e. from the smallest key to the greatest. The Key property of the tree is set according to the value in the enumerator.
enumerable
with the FOR EACH keyword.

Properties

Methods
Return the balance factor of the AvlTree. It is either -1, 0 or 1.
Balance  
Return the number of elements in the tree.
Count  
Return the height of the tree.
Height  
Return the last used key. This can be Null if the element was removed meanwhile.
Key  
Clear the tree, i.e. remove all elements. This is way faster than removing every element by assigning Null to it like
Clear  
Return whether an element with the given key exists.
Exist  

See also