Queues

A queue is like a line at the movie theater. It's "first in, first out" (FIFO), which means that the item that was put in the queue longest ago is the first item that comes out. "First come, first served."

Loading...

Queues have two main methods:

  1. enqueue : adds an item
  2. dequeue : removes and returns the next item in line

They can also include some utility methods:

  1. peek : returns the item at the front of the queue, without removing it.
  2. is_empty : returns True if the queue is empty, False otherwise

See also:

Pass Your Interviews with My FREE 7-Day Crash Course

I'll teach you the right way of thinking for breaking down tricky algorithmic coding interview questions you've never seen before.

No prior computer science training necessary—I'll get you up to speed quickly, skipping all the overly academic stuff.

No spam. One-click unsubscribe if you hate it.

Psst. Pass it on.

. . .