1) After the following statements execute, what are the contents of the priority queue? PriorityQueueInterface myPriorityQueue = new LinkedPriorityQueue(); myPriorityQueue.add("a1");...


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):



Jun 09, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here