Why we prefer Circular Queue over Linear Queue ?
Answers
Answer:
Efficient utilization of memory: In the circular queue, there is no wastage of memory as it uses the unoccupied space, and memory is used properly in a valuable and effective manner as compared to a linear queue.
Answer:
Circular queue is better than a linear queue because we can effectively utilise the memory space
Explanation:
circular queue and a linear queue for storing some items. Now when I remove these items from the front of the queue, the space in the front of the linear queue can’t be used anymore, whereas in the circular queue the space still remains available for adding any further items. The figure below should clarify things.
No space is wasted when the rear pointer reaches to the end of the array, as it can loop back to the first position and continue to fill unless first and rear are at the same position(means that the queue is full).This is not possible in a linear queue, where no more insertion can be done after the rear pointer reaches the end of the array.