1) After the following statements execute, what are the contents of the priority queue?
PriorityQueueInterface myPriorityQueue = new LinkedPriorityQueue(); myPriorityQueue.add("a1");myPriorityQueue.add("a4");myPriorityQueue.add("a3");myPriorityQueue.add("a2");String st = myPriorityQueue.remove();myPriorityQueue.add(st);myPriorityQueue.add (myPriorityQueue.peek());myPriorityQueue.add("a2");myPriorityQueue.remove();Initially, assume myPriorityQueue is empty and priority is interpreted as coming first in a lexicographical ordering (dictionary order):
myPriorityQueue.add("a4");
myPriorityQueue.add("a3");
myPriorityQueue.add("a2");
String st = myPriorityQueue.remove();
myPriorityQueue.add(st);
myPriorityQueue.add (myPriorityQueue.peek());
myPriorityQueue.remove();
Initially, assume myPriorityQueue is empty and priority is interpreted as coming first in a lexicographical ordering (dictionary order):
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here