Similar to a stack, but the item that is inserted first is the one removed first, following the First In, First Out (FIFO) principle.

<aside> 💡 Imagine a line of people in a queue, where the person who joined first will leave first.

</aside>

Applications

Operations

Queue Interface




Priority Queues:

In priority queues, objects are processed based on their priority, not in the order they joined the queue.

<aside> 💡 Priority queues are suitable when resources need to be shared among multiple consumers, and these consumers should access the resource one by one based on their priority.

</aside>

Note