Using a priority queue, I implemented my own min and max heap