To insert a node into a tree with such a property:
First insert the node into the tree using the rules of Binary Search tree
based on Value i .
Now compare Node-j and Node-Parent-j. Depending upon the result of
comparison perform left rotation or right rotation so that the Heap property
is also
Lets assume that the tree node has two keys K1 and K2.
K1 satisfies the BST property
K2 satisfies the Max Heap Property.
Our problem is to build a binary tree which satisfies both the
properties.
For a maximal heap the root node must be the maximum.
So we find the node which has the K2 max. And