A balanced binary search tree which is also a heap

Posted by saeedn on Stack Overflow See other posts from Stack Overflow or by saeedn
Published on 2012-09-08T05:18:52Z Indexed on 2012/09/08 9:38 UTC
Read the original article Hit count: 252

I'm looking for a data structure where each element in it has two keys. With one of them the structure is a BST and looking at the other one, data structure is a heap. With a little search, I found a structure called Treap. It uses the heap property with a random distribution on heap keys to make the BST balanced!

What I want is a Balanced BST, which can be also a heap. The BST in Treap could be unbalanced if I insert elements with heap Key in the order of my choice.

Is there such a data structure?

© Stack Overflow or respective owner

Related posts about algorithm

Related posts about data-structures