improve Treap impl