Treap data structure, with non-recursive merge/split