implement a treap