Which of the following that determines the need for the Circular Queue?
2023
Which of the following that determines the need for the Circular Queue?
- A.
Avoid wastage of memory
- B.
Access the Queue using priority
- C.
Follows the FIFO principle
- D.
None of the above
Attempted by 420 students.
Show answer & explanation
Correct answer: A
Answer: a
Explanation: The answer is a, i.e., Avoid wastage of memory. In a linear queue, there are chances of wastage of memory because if the rear is pointing to the last element whereas the front is pointing to the element other than the first element; it means that spaces allocated before the front are free, but it cannot be reused as rear cannot be incremented.
In contrast, the last element is connected to the first element in a circular queue; if initial spaces are vacant, then rear can be incremented by using the statement (rear+1) mod max where max is the size of the array. Therefore, we conclude that the circular queue avoids wastage of memory.