Codecademy Logo

Learn Queues

Related learning

  • Learn about virtualization of computer memory by building the fundamental data structures of computer science: lists, stacks, and queues.
    • With Certificate
    • Intermediate.
      4 hours

Queue data structure methods

The queue data structure has three main methods:

  • enqueue (adds a node to the back of the queue)
  • dequeue (removes node at the front of the queue)
  • peek (returns value of node at the front of the queue, without removing it)

Queue follows FIFO protocol

A queue is a data structure composed of nodes, which follows a first in, first out (FIFO) protocol.

This is analogous to a line at a grocery store, for which the first customer in the queue is the first to checkout.

Learn more on Codecademy

  • Learn about virtualization of computer memory by building the fundamental data structures of computer science: lists, stacks, and queues.
    • With Certificate
    • Intermediate.
      4 hours