CP-Algorithms explains treap data structure combining BST and heap properties
The article describes the treap (cartesian tree), a data structure that stores (X,Y) pairs as a binary search tree ordered by X and a binary heap ordered by Y. It credits Raimund Seidel and Cecilia Aragon with proposing the structure in 1989, and explains that assigning random priority values yields balanced trees, giving operations like insert and search O(log N) average complexity.
GoKawiil's interpretation of the reporting above, not reported fact.
Because random priorities prevent the degenerate, linked-list-like shapes that plain binary search trees can fall into, treaps offer a practical way to get balanced-tree performance without complex rebalancing logic, which could make them appealing for implementing ordered sets, ranges, and similar structures in competitive programming and systems code.
- A treap merges BST ordering by key (X) with heap ordering by priority (Y).
- Randomized priorities statistically guarantee balanced trees, giving O(log N) operations.
- The structure was proposed by Raimund Seidel and Cecilia Aragon in 1989 and is also called a randomized binary search tree.
Source: cp-algorithms.com, 2026-10-26
Published there as: “Treap (Cartesian Tree)”
Read the original report → The summary and analysis above are GoKawiil's own, written from reporting by the source above. Facts and quotes belong to the original publisher.