What is the need for a circular queue?

Minh Phượng

New member
What is the need for a circular queue?
A. effective usage of memory
B. easier computations
C. to delete elements based on priority
D. implement LIFO principle in queues
 
Answer: A
Explanation: In a linear queue, dequeue operation causes the starting elements of the array to be empty, and there is no way you can use that space, while in a circular queue, you can effectively use that space. Priority queue is used to delete the elements based on their priority. Higher priority elements will be deleted first whereas lower priority elements will be deleted next. Queue data structure always follows FIFO principle.
 

Tìm kiếm

Back
Top