// File: PQTester.java
import java.io.*;
import java.util.*;
public class PQTester
{
public static void main (String args[])
{
PriorityQueue pq = new PriorityQueue ();
Random r = new Random (1); // Fixed seed -> repeatable
// Insert 10 integers with random priorities
for (int i=0; i<10; ++i)
pq.Insert (new Integer (i), r.nextDouble ());
// Remove and print them
System.out.println ("Dequeuing");
for (int i=0; i<10; ++i)
try
{
System.out.println (" " + pq.Remove ());
}
catch (Exception e)
{
}
}
}
// File: PriorityQueue.java
class PriorityQueue
{
public PriorityQueue ()
{
// constructor: initialize any private data here.
}
public void Insert (Object data, double priority)
{
}
public Object Remove ()
{
return null;
}
}
Please bring the paper copy to class on friday. If you need to make special arrangements (either for turnin or extensions) please send Andy (acollins@cs.washington.edu) email.