Question: Let n be any positive integer. Is it possible to construct a priorty queue A of size n with the property that at every iteration
Let n be any positive integer. Is it possible to construct a priorty queue A of size n with the property that at every iteration of operation DELETEMIN the process substituting the process with the smallest priority will be eventually placed on the last position. Provide either a construction or an argument showing that a priority queue with the above property does not exit.

function DELETEMIN(var A. PRIORITYQUEUE): processtype; var i,j: integer; temp: processtype minimum: processtype; begin new(minimum); minimum :-A.contents(1); A.contents[1]: A.contents[A.last]; Alast := A. last-1; while iA.last div 2 do begin if (2% = A.last) or (p(A.contents[2%) p(A.contents[j1) then begin temp- A.contcntslij; A.contentslij: A.contentsl: A.contentsli): temp end else return (minimum) end; return (minimum) end
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
