Question: Part 2: Advanced Queue (optional) Exercise 1. Priority Queue Based on the above program, create a function void priorityQueue (queue q), which accept current queue

Part 2: Advanced Queue (optional) Exercise 1. Priority Queue Based on the above program, create a function void priorityQueue (queue q), which accept current queue and insert new priority queue (int) at the front of the current queue Thus all items in current queue after inserting the new priority item will be moved. Simulate the priority queue by using random Boolean event. Pseudo Code: function priorityQueue (queue q) boolean priority = random Boolean //random Boolean event queue tmp if priority then get front a pop front to tmp while q is not empty get front from a new = front+1 pop from a push new to tmp end while else return a return tmp end function
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
