We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Priority Queue Code

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.

Assignment

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.