A queue is a linear data structure that follows the FIFO (First In, First Out)
principle.
Elements are added at the rear and removed from the front.
-
Simple Queue:
Follows FIFO. Insert at rear, delete from front.
-
Circular Queue:
Connects rear to front to reuse space efficiently.
-
Priority Queue:
Elements are dequeued based on priority, not order.
-
Deque (Double-Ended Queue):
Insertion and deletion are allowed at both ends.
-
enqueue(x):
Add x to rear
-
dequeue():
Remove front element
-
peek():
View front element
-
is Empty():
Check if queue is empty