Constructing Treap data structure

Hi All,

When constructing TREAP data structure we have both key and random number for a node.

What if we have a conflict in constructing as BST as random priority for each element should follow heap properties and keys of nodes should follow BST properties...?

Ex:We should construct TREAP for Alphabets K(15),F(29),P(13),M(22),N(26),L(10),G(17) With given random priorities given in brackets for each alphabet.

First I will start with L as node as it has least priority and random priority should follow heap property.

Now if we arrange remaining letters also so that their random priorities follow heap priority then after construction that doesn't follow BST properties....Please help
Topic archived. No new replies allowed.