persistent data structure (treap) with reference count