I'm trying to understand how to build a double-ended priority queue using two heaps: a min heap and a max heap. My thinking so far is that I'll need one array to store the min heap, and another to store the max heap, and then I need to figure out how to connect the relevant entries in the two arrays to each other. E.g., I need to make sure that wherever the value "12" ends up in the min heap somehow points to where the value "12" is in the max heap, and vice versa. I understand that in theory, but I have no idea how to go about actually implementing it.
How can I make elements in one array point to elements in another array in an efficient and flexible way? Especially since each array is going to be continually re-shuffled throughout the program.
Not sure if that made sense, but any help is most appreciated. Thanks.