You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/hitchhiker.adoc
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ Let's look at each of these in some detail.
13
13
You might remember an important theorem from data structures: the best-performing data structure for looking up sorted keys cannot do those queries faster than `O(log(n))`.
14
14
Since sorted trees provide a solution for this, we'll start with them.
15
15
Now, a common sorted tree for this purpose is the Red-Black tree, whose actual query performance is between `log~2~(n)` and `2*log~2~(n)` (the write performance is `log~2~(n)`).
16
-
The factor of 2 comes from the partial imbalances (which are still asymtotically balanced) that the algorithm allows, and the base 2 of the log comes from the fact that it's a binary search tree.
16
+
The factor of 2 comes from the partial imbalances (which are still asymptotically balanced) that the algorithm allows, and the base 2 of the log comes from the fact that it's a binary search tree.
17
17
18
18
A less popular sorted tree is the AVL tree--this tree achieves `log~2~(n)` query performance, at the cost of always paying `2*log~2~(n)` for inserts.
19
19
We can already see a pattern--although many trees reach the asymptotic bound, they differ in their constant factors.
0 commit comments