

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Priority Queues
incomplete
2: Priority Queue Code
incomplete
3: Heaps
incomplete
4: Why Use Heaps?
incomplete
5: Pop
incomplete
6: Priority Queue With a Heap
incomplete
This lesson's interactive features are locked, please to keep using them
To start, let's build a simple priority queue. Rather than the efficient but more complex code required for O(log(n)) inserts and pops, let's begin with an implementation that offers O(1) inserts and O(n) pops.
In Mappy, we need to find the shortest route while taking into account traffic jams. The delay in minutes on a given street will determine its "priority" in the priority queue. Larger delay == lower priority.
Complete the empty, push, and pop methods.