insertion very quickbut unfortunately it makes deletion slow because the smallest item must be searched for this approach requires examining all the items and shifting half of themon the averagedown to fill in the hole in most situations the quick-deletion approach shown in the workshop applet is preferred for small numbers of itemsor situations in which speed isn' criticalimplementing priority queue with an array is satisfactory for larger numbers of itemsor when speed is criticalthe heap is better choice java code for priority queue the java code for simple array-based priority queue is shown in listing listing the priorityq java program /priorityq java /demonstrates priority queue /to run this programc>java priorityqapp ///////////////////////////////////////////////////////////////class priorityq /array in sorted orderfrom max at to min at size- private int maxsizeprivate long[quearrayprivate int nitems//public priorityq(int /constructor maxsize squearray new long[maxsize]nitems //public void insert(long item/insert item int jif(nitems== /if no itemsquearray[nitems++item/insert at else /if itemsfor( =nitems- >= --/start at endifitem quearray[ /if new item largerquearray[ + quearray[ ]/shift upward