Queue

Definition

FIFO data structure with two operations enqueue (adds element at back) and dequeue (pops element at the head). There exists:

  • simple queue
  • circular queue
  • priority queue: add element with a corresponding priority, dequeuing pops the element having the highest priority.
  • double ended queue: enqueuing and dequeuing possible from both ends.

Implementations

  • simple and circular queues: dynamic array or linked list.
  • priority queue: heap.
  • double ended queue: vector of pointers to chunks of vectors (C++ STL implementation)
    deque

Complexity

Queue

Operation Complexity
Enqueue
Dequeue

Append and deletion complexities of dynamic array.

Priority queue

Operation Complexity
Enqueue
Dequeue

Append and deletion complexities of heap.

Deque

Operation Complexity
Access
Search
Enqueue amortized
Dequeue amortized
Insert
Remove

TODO