Fork me on GitHub

Class comb.collections.AVLTree


Extends comb.collections.Tree.

An AVL tree is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one. Lookup, insertion, and deletion all take O(log n) time in both the average and worst cases, where n is the number of nodes in the tree prior to the operation. Insertions and deletions may require the tree to be rebalanced by one or more tree rotations.

AVL trees are more rigidly balanced than red-black trees, leading to slower insertion and removal but faster retrieval

Performance
BestWorst
SpaceO(n)O(n)
SearchO(log n)O(log n)
InsertO(log n)O(log n)
DeleteO(log n)O(log n)

Defined in: AVLTree.js.
Methods borrowed from class comb.collections.Tree:
clear, contains, every, filter, find, findGreaterThan, findLessThan, forEach, insert, isEmpty, map, print, reduce, reduceRight, remove, some, toArray, traverse, traverseWithCondition
Methods borrowed from class comb.collections.Collection:
concat, indexOf, join, lastIndexOf, slice, toString

Class Detail
comb.collections.AVLTree()

Documentation generated by JsDoc Toolkit 2.4.0 on Tue Jan 31 2012 16:14:11 GMT-0600 (CST)