Back to the Catalog
data-structures
frontend
javascript

Undo, Redo, and Back: Stacks and Queues in the UI

10 questions

LIFO and FIFO made concrete in the interfaces you build every day: undo/redo as two mirrored stacks, the classic bug where a fresh edit must clear the redo stack, the browser's Back button as a history stack, a render/task queue as FIFO, and a deque-backed "recent items" list. Every code trace is verified by running it in Node.

Questions

  1. Not answered. Undo modeled as a stack: which edit is undone first?
  2. Not answered. Which array operations turn a JS array into a FIFO queue?
  3. Not answered. Pressing Undo moves the popped operation where?
  4. Not answered. The classic bug: a fresh edit after Undo
  5. Not answered. Back, then a new link: what happens to forward history?
  6. Not answered. What does a breadcrumb trail actually represent?
  7. Not answered. Stack and queue operations and terminology
  8. Not answered. Which of these behave like a stack (LIFO)?
  9. Not answered. Bounded history and a recent-items deque
  10. Not answered. Name the double-ended structure