Question:
Suppose you have a list of integers and it might contain duplicates. Build a Max Heap using this list. Where would the duplicates of the max integer reside in this Max Heap data structure? Where would the duplicates of other integers reside in the heap?
My Answer: The duplicates can reside below (as children of) the value considering a heap (tree structure). Or if we are using arrays to implement this Max Heap, then the duplicates would reside on the indices H[2i + 1] and H[2i + 2] where i is the index of the parent node.
Or we can even make a pointer to a link list of duplicates from that node which has duplicates.
The teacher said that there is another way.
Could you please give me hints on how to do it? Or at least how to answer this question?