Codecademy Logo

Queues

Related learning

  • A full-stack engineer can get a project done from start to finish, back-end to front-end.
    • Includes 51 Courses
    • With Professional Certification
    • Beginner Friendly.
      150 hours
  • Back-end developers deal with the hidden processes that run behind the scenes, building APIs and databases that power the front-end.
    • Includes 41 Courses
    • With Professional Certification
    • Beginner Friendly.
      105 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

  • A full-stack engineer can get a project done from start to finish, back-end to front-end.
    • Includes 51 Courses
    • With Professional Certification
    • Beginner Friendly.
      150 hours
  • Back-end developers deal with the hidden processes that run behind the scenes, building APIs and databases that power the front-end.
    • Includes 41 Courses
    • With Professional Certification
    • Beginner Friendly.
      105 hours