# Undo the Last Thing First: Stacks

An editor has to take back its most recent change first, then the one before, after 10,000 edits as quickly as after 10. Find a structure that keeps undo instant, and learn why it does less than a list on purpose: the stack.

![Cheat sheet: Undo the Last Thing First: Stacks](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/94a0e6e321c8421685b1ec08cabfb9c3.webp)

- Category: Data Structures
- Level: Apprentice
- Tags: "Last In", "First Out", data structures, Peek, Push and Pop, stack
- Updated: November 3, 2026

Source: https://www.ask-codey.com/cheat-sheets/ds-stacks-cheat-sheet
