Why The Plain Column Jumps
The 15-122 notes insert entries into a tree and look them all up, timing AVL trees against plain binary search trees that never rebalance. Each row is 100 repetitions, in seconds:
| n | AVL | plain BST |
|---|---|---|
| 0.620 | 3.094 | |
| 1.373 | 7.745 | |
| 2.980 | 20.443 | |
| 6.445 | 27.689 | |
| 13.785 | 48.242 |
The AVL column roughly doubles each row. The plain column multiplies by 2.5, then 2.6, then 1.35, then 1.7. The keys were the integers counted upward and converted to strings, compared lexicographically, so the order is "0" < "1" < "10" < "12" < "2" and so on.
What explains the plain column's uneven growth?
Sign in to answer questions and track your progress
Sign In