Contents    Page-10    Prev    Next    Page+10    Index   

Balanced Binary Trees

We have seen that searching a binary tree is very efficient, O(log(n)); however, this is only true if the tree is balanced, i.e. the two branches of a node have approximately the same height. If the tree is unbalanced, search time could be worse, perhaps even O(n).

There are several clever algorithms that maintain self-balancing binary trees; these algorithms re-balance the tree as needed.