Algorithm Wiki

Site Tools

This is an old revision of the document!

Queue

A queue is a collection data type where the primary operations are enqueue which adds an element and dequeue which removes. It is a First-In-First-Out (FIFO) data structure, the first element pushed must be the first one removed.

Properties

• $O(1)$ enqueue
• $O(1)$ dequeue
• $O(n)$ space