
4.4K
PRQueue - Explained.
A queue is a linear data structure that follows the rule
First item added is the first item removed.
Think of it like a line at a bus stop.
The person who comes first gets on the bus first.
New people join at the back.
Queue Methods:
Enqueue
Adds an element to the back of the queue.
Dequeue
Removes the element from the front.
Front or Peek
Returns the front element without removing it.
IsEmpty
Checks if the queue is empty.
Size
Returns the number of elements.
Time Complexity:
Enqueue
O(1)
Dequeue
O(1)
Peek
O(1)
Search
O(n)
Where It’s Used:
Task scheduling in operating systems
Handling requests in servers
Breadth First Search in graphs
Printer job management
@project.maang.2026










