Don't like this style? Click here to change it! blue.css

Lab 9 and 10: Double-Ended Priority Queue

So we're almost done learning every ADT and implementing them in many interesting ways. Today I wanted to give you a chance to go deeper with heaps and have you implement a double-ended priority queue. Wikipedia's version here. The upshot is you should be able to do pop_min() or pop_max() quickly.

Your Task:

Build a Double-Ended Priority Queue with insert, min, max, pop_min, and pop_max.

Build it by having two heaps (one min-heap and one max-heap), but the array should be an array of Nodes. Where each Node stores data and the index of the partner value in the other heap.

I would write your own "swap" that updates the correct nodes.

Here is a main() for you to begin from and make work:

Good luck!