A linear sequential collection governed by the First-In, First-Out (FIFO) principle. Elements enter at the rear (tail) and depart from the front (head).
Queues emulate standard waiting lines: arrival occurs strictly at the back, while service takes place at the front. Core real-world applications include OS process scheduling (CPU ready queue), IO buffering, print spooling, and BFS graph traversal.
Appends value x to the rear end of the queue. Fails if maximum allocated capacity is reached.
Removes and returns the front element. Fails with an underflow error if the queue is empty.
Read-only inspections of the extreme elements (front index 0 or rear index n-1) without mutation.
Linear static array queues without cyclic wrap-around can cause wasted space after repeated dequeues.