The Structure
Unlike an array where you can insert or delete anywhere, a Queue restricts you: you can only insert at the back (Rear) and remove from the front (Front).
Loading...
Loading Curriculum...
Loading Subject...
Loading Topic...
Loading Lesson...
Loading Lab...
A Queue is a linear data structure that models real-world waiting lines. It strictly follows the First-In-First-Out (FIFO) principle.
Unlike an array where you can insert or delete anywhere, a Queue restricts you: you can only insert at the back (Rear) and remove from the front (Front).
Think of a drive-thru or a ticket counter. The first car in line is the first one to get their food. Anyone new arriving must go to the very back of the line.
Queues are used when things don't have to be processed immediately, but DO have to be processed in the exact order they arrived (e.g., printer spools, network packets, web server requests).