previous | index | next

Balanced Trees and Search Efficiency

A tree of height h is also balanced if its tree of height h-1 is full:

This tree is not balanced:

In the worst case, an unbalanced tree's height is n-1 and searching for an element in it takes O(n) time.


previous | index | next