Queues and Deques

We have learned how stacks work. Queues are a very similar data structure, but instead of LIFO, they use a different principle that we will learn about in this chapter. We will also learn how deques, a data structure that mixes the stack and queue principles, work.

In this chapter, we will cover the following topics:

  • The queue data structure
  • The deque data structure
  • Adding elements to a queue and a deque
  • Removing elements from a queue and a deque
  • Simulating circular queues with the Hot Potato game
  • Checking whether a phrase is a palindrome with a deque

Get Learning JavaScript Data Structures and Algorithms - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.