[EDITED!!!] Having read about different data structures and created many of them (in C++) I just wondering how could we make a data structure where each node would be a pair of keys (x,y), where x would refer to a value of a Max Heap and y to a key of a Binary Search Tree. I would like something like a BST and Max Heap at the same time (using tuples or pairs of keys as nodes each time). To make it more clear, technically I mean that in each node i of the tree a pair of keys (x,y) will be stored where x is the priority of the key and y will be the the value of the key.
It will be able to support all the functionalities of the above mentioned data structures, such as the insertion and deletion. For example, regarding deletion the tuple is going to go consecutively deeper by a sequence of simple consecutive rotations, until the tuple be a leaf. Then the deletion is easy as far as you know. If the tuple – the one we would like to delete - would be a leaf or an inner node, the deletion could be done in the same way as in BSTs.
Regarding insertion a tuple will be inserted into the tree only based on the key of the binary search tree. After that, the pair is going to be moved consecutively higher in the tree until the fundamental property of max heaps be violated.
Moreover, I have some extra functionalities into my mind. An additional function could be something like find_second_next(), taking as argument the x key, which is already on the tree, and this function will find the second smaller among all the y keys of the tree which are greater than x. Another function could be a print_between(k1,k2) as well. This function will print all y keys of the tree having value in the range [k1,k2]. Finally, I would like to have also a print_with_higher_priority(x) function which will print all the x keys of the tree which are greater than x.
If you have some additional functionalities write them! :D
I am looking forward to seeing your contribution to this question!