Data Structures19 sections · 729 units
Open in Course

Vocabulary - Queue

First in, first out

A queue is a First-In-First-Out (FIFO) data structure. Elements leave in the same order they arrived.

Three operations:

  • Enqueue (or push): add an element to the back
  • Dequeue (or pop): remove and return the front element
  • Front (or peek): view the front element without removing

All three operations are O(1)O(1). Unlike stacks, you remove from the opposite end from where you add.