Is there any use for a binary search tree that is not self-balanced?

234 Views Asked by At

All of the types of binary search trees I can find are self-balancing. Are there any that aren't, that are actually useful?

2

There are 2 best solutions below

0
On BEST ANSWER

The first example that comes to my mind is a Rope, a binary tree that is used to store and edit efficiently long strings, such as in text editors.

It is not balanced per se, but Concatenation and Split require the tree to be balanced. But every character can be accessed O(log N) even in unbalanced trees, so maybe this fits your question

3
On

Every Binary Search Tree that does not actively perform balancing may become unbalanced.

In particular, inserting a (reverse) sorted sequence into a BST will lead to a degenerate tree (essentially a linked list):

3 2 1

    3
   /
  2
 /
1

and

1 2 3

1
 \
  2
   \
    3