Question: In JAVA implement the Priority Queue ADT. That means implementing all the 5 functions and run your codes on Example 9.1. Your program should print
In JAVA implement the Priority Queue ADT. That means implementing all the 5 functions and run your codes on Example 9.1. Your program should print out that table in Example 9.1
Functions:


insert(k,v)Createsanentrywithkeykandvaluevinthepriorityqueue.min()Returns(butdoesnotremove)apriorityqueueentry(k,v)havingminimalkey;returnsnullifthepriorityqueueisempty.removeMin()Removesandreturnsanentry(k,v)havingminimalkeyfromthepriorityqueue;returnsnullifthepriorityqueueisempty.size()Returnsthenumberofentriesinthepriorityqueue.isEmpty()Returnsabooleanindicatingwhetherthepriorityqueueisempty. Example 9.1: The following table shows a series of operations and their effects on an initially empty priority queue. The "Priority Queue Contents" column is somewhat deceiving since it shows the entries sorted by key. Such an internal representation is not required of a priority queue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
