Playing With a Full Deque (Double-Ended Queue)
Write a program to service requests from a number of tech users. Suppose that at any time there is one job being processed; requests from all users except one are placed in queue for FIFO servicing. The special user is privileged (for whatever reason) and is treated such that any request from this user is placed at the front of the queue for immediate handling. Should the queue be full when a priority request is made, the last entry will be bumped (deleted) to a standby queue and reentered when size permits.
This results in a deque data structure, in which:
additions of regular requests are made to the REAR
additions of priority requests are made to the HEAD
deletions of both types of requests are made from the HEAD
deletion due to bumping is made from the REAR
Input data records may contain: a job number, type of request, time of request, service time requirement, etc. Output should follow movement of jobs (requests) through the system over time.