posts: treap: add presentation

This commit is contained in:
Bruno BELANYI 2024-07-20 19:21:47 +01:00
parent 6d7b2cce11
commit a4b02f3644

View file

@ -27,3 +27,13 @@ parent's priority is always higher than any of its children.
[wiki]: https://en.wikipedia.org/wiki/Treap [wiki]: https://en.wikipedia.org/wiki/Treap
<!--more--> <!--more-->
## What does it do?
By randomizing the priority value of each key at insertion time, we ensure a
high likelihood that the tree stays _roughly_ balanced, avoiding degenerating to
unbalanced O(N) height.
Here's a sample tree created by inserting integers from 0 to 250 into the tree:
{{< graphviz file="treap.gv" />}}