The priority queue shown in listing 46 features fast


The priority queue shown in Listing 4.6 features fast removal of the high-priority item but slow insertion of new items. Write a program with a revised PriorityQ class that has fast O(1) insertion time but slower removal of the highpriority item. Include a method that displays the contents of the priority queue, as suggested in Programming Project 4.1.

Project 4.1

Write a method for the Queue class in the queue.java program (Listing 4.4) that displays the contents of the queue. Note that this does not mean simply displaying the contents of the underlying array. You should show the queue contents from the first item inserted to the last, without indicating to the viewer whether the sequence is broken by wrapping around the end of the array. Be careful that one item and no items display properly, no matter where front and rear are.

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: The priority queue shown in listing 46 features fast
Reference No:- TGS01647195

Expected delivery within 24 Hours