Engrain by ByteRush

DSA.03.03 JuniorCore — asked often

Stacks, queues and deques

Comes up in: DSA, Coding

This concept is being written. It gets the full five steps — explanation, predict, interview angle, practice with tests, and review cards. Here is exactly what it will cover, so you can study it elsewhere in the meantime.

What it covers

  • LIFO/FIFO
  • array-backed stack
  • queue with two stacks or ring buffer
  • deque
  • uses (undo, BFS, parsing)

Words you will know

stackqueuedequering buffer

What you will practise

  • implement Queue (O(1) dequeue) and Deque

Interview questions this answers

  • Implement a queue with O(1) enqueue and dequeue in JavaScript.
  • When is a linked list better than an array?