Compare commits
7 commits
40dd12c50a
...
a868474177
Author | SHA1 | Date | |
---|---|---|---|
Bruno BELANYI | a868474177 | ||
Bruno BELANYI | 9728aa537e | ||
Bruno BELANYI | 4c12ebb16c | ||
Bruno BELANYI | ca89605db5 | ||
Bruno BELANYI | 1539ed5ce9 | ||
Bruno BELANYI | f981ee9903 | ||
Bruno BELANYI | a4b02f3644 |
|
@ -31,7 +31,7 @@ parent's priority is always higher than any of its children.
|
||||||
## What does it do?
|
## What does it do?
|
||||||
|
|
||||||
By randomizing the priority value of each key at insertion time, we ensure a
|
By randomizing the priority value of each key at insertion time, we ensure a
|
||||||
high likelihook that the tree stays _roughly_ balanced, avoiding degenerating to
|
high likelihood that the tree stays _roughly_ balanced, avoiding degenerating to
|
||||||
unbalanced O(N) height.
|
unbalanced O(N) height.
|
||||||
|
|
||||||
Here's a sample tree created by inserting integers from 0 to 250 into the tree:
|
Here's a sample tree created by inserting integers from 0 to 250 into the tree:
|
||||||
|
@ -41,8 +41,8 @@ Here's a sample tree created by inserting integers from 0 to 250 into the tree:
|
||||||
## Implementation
|
## Implementation
|
||||||
|
|
||||||
I'll be keeping the theme for this [series] by using Python to implement the
|
I'll be keeping the theme for this [series] by using Python to implement the
|
||||||
_Treap_. This leads to somewhat annoying code to handle the `left`/`right` nodes
|
_Treap_. This leads to somewhat annoying code to handle the rotation process,
|
||||||
which is easier to do in C, using pointers.
|
which is easier to do in C using pointers.
|
||||||
|
|
||||||
[series]: {{< ref "/series/cool-algorithms/" >}}
|
[series]: {{< ref "/series/cool-algorithms/" >}}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue