Assignment #3


For this assignment you are going to implement a Priority Queue as a Binary Heap. If that goes into your project well, use it there. If not, then you implement one and compare its speed with that of a list based priority queue. For the speed test, just have Queues of Doubles and insert a bunch of numbers, then remove them. Use System.nanoTime to measure how long it takes.

To have something you can draw conclusions from, you want to be somewhat structured in regards to how much you add. Do runs with 100, 1000, 10000, ... different values. Generate them with math.random and add them in, then remove them all. Time how long it takes to do that and keep going up in numbers until you either run out of memory or get to the point where it is too slow for you to wait. Note that point will be different for the two implementations. Plot this using a log-log scatter plot and submit the plot with your code.