All of the types of binary search trees I can find are self-balancing. Are there any that aren't, that are actually useful?
Asked
Active
Viewed 170 times
2 Answers
0
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

Jörg W Mittag
- 363,080
- 75
- 446
- 653
-
My question was confusing, so I edited it a bit. Your point is well taken. So are you saying that all binary search trees self-balance? – mattalxndr Aug 15 '18 at 10:44
-
No, I am saying that *only* self-balancing binary search trees self-balance, and I give an example in my answer of how a binary search tree becomes unbalanced, if it is not actively balanced. – Jörg W Mittag Aug 15 '18 at 10:48
-
Is there any use for a binary search tree that is not self-balanced? – mattalxndr Aug 15 '18 at 10:54
0
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

Simone Chelo
- 706
- 8
- 25