Question: Assume the application implements an unbounded min-priority queue . A customer joins the queue behind all customers already queueing with the same priority. All customers
Assume the application implements an unbounded min-priority queue.
A customer joins the queue behind all customers already queueing with the same priority. All customers with priority value 1 are queued in the order they joined, before all customers with priority value 2, and so on. The next customer to be allocated a seat will be the customer currently at the front of the queue. A customer is represented by a unique string.
For example, if customers join the queue in this order:
| Customer | Priority value |
|---|---|
| Smith25 | 2 |
| Thomson3 | 4 |
| Tang18 | 1 |
| Eber87 | 1 |
| Green201 | 2 |
they will be queued in this order, where the left end is the front of the queue:
Complete the table below to help you decide whether to implement the queue as a dynamic array or a singly linked list.
Write your answer here
| Question | Your Answer |
|---|---|
| Which operations are most frequently needed? | |
| For the same queue, which implementation method uses less memory? | |
| Are items shifted on insert/remove for a dynamic array? | |
| Are items shifted on insert/remove for a linked list? |
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
