| Quick Reference Stack CheatsheetA stack on one page — push, pop, and peek, and the traps around the bottom, empty pops, and bracket order. 10 sections 10 tables 14 code snippets Last in, first outPush Pop The rule
This page is a stack. A queue is left out. OperationsPeek leaves the top in place Cost at the top
Array and linksEmpty array stack Where the top lives
A Python listThe slow end Nothing to pop The list is the stack
BracketsThe closer must match the top Counts are not order One pass
The call stackEach call waits on a deeper one Frames
Min stackRemember this minimum O(1) minimum
Next greaterPop anything smaller One decreasing stack
Where stacks show upOperand order The same LIFO idea
Interview trapsPeek is not a remove Index 0 is the oldest Traps worth memorising
How to use this page: push with |