Orbit · Explore

Programming · by Mehdi Benali · 2026-10-28

Treap (Cartesian tree): the data structure you forgot you liked

cp-algorithms.com

Random priorities + BST ordering = balanced-ish tree with simple split/merge. Way easier to implement than red-black trees. Anyone actually using treaps in production code, or is it just a competitive programming thing?

20 sparks · 2 comments

Comments

Sofía Hernández · 5 likes

treaps are what you write when you have 20 minutes left in a contest

Miguel Santos · 0 likes

used one for an interval scheduler once, split/merge made range ops super clean