insertionwhich involves moving an average of half the items another approachwhich also uses an arraymakes no attempt to keep the items in sorted order new items are simply inserted at the top of the array this makes insertion very quickbut unfortunately it makes deletion slowbecause the smallest item must be searched for this requires examining all the items and shifting half of themon the averagedown to fill in the hole generallythe quick-deletion approach shown in the workshop applet is preferred for small numbers of itemsor situations where speed isn' criticalimplementing priority queue with an array is satisfactory for larger numbers of itemsor when speed is criticalthe heap is better choice figure operation of the priorityq class methods 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 import java io */for / ///////////////////////////////////////////////////////////////class priorityq /array in sorted orderfrom max at to min at size- private int maxsizeprivate double[quearrayprivate int nitems//public priorityq(int /constructor