stack fundamentalsCreate a stackUnderstand LIFOIdentify the topHandle an empty stackDistinguish top from the restCount items on a stackBuild a stack from values
pushPush one valuePush onto an empty stackPush onto a nonempty stackPush several values in orderKeep the new top after pushWhy stack push is O(1)
popPop the topPop from a one-item stackReject pop from emptyPop several values in orderReturn the popped valueWhy stack pop is O(1)
peek and queryPeek the topPeek does not removeCheck whether a stack is emptyRead the stack sizeReject peek on empty
array-backed stacksStore a stack in an arrayKeep a top indexPush by writing then incrementingPop by decrementing then readingGrow the backing arrayHandle stack overflow
list-backed stacksStore a stack as a linked listPush as insert at headPop as delete the headTreat head as the topEmpty list is empty stack
LIFO tracesTrace a sequence of pushes and popsReconstruct remaining stack itemsDecide if a pop sequence is validSimulate interleaved stack operationsRead the stack from bottom to top
reversing with a stackReverse an array with a stackReverse a string with a stackReverse a list with a stackWhy a stack reverses orderRestore by reversing twice
matching bracketsPush an opening bracketPop on a matching closerReject a mismatched closerReject leftover openingsHandle multiple bracket typesTreat an empty string as balanced
nested structuresTrack nesting depth with a stackMatch the nearest openerParse nested pairsStop at the matching closerDistinguish nested from adjacent pairs
pop whilePop while the top fails a conditionLeave the first valid topEmpty the stack with pop-whilePop-while for next greaterPop-while for next smaller
expressionsPush operandsApply an operator to two popsEvaluate postfix with a stackConvert infix to postfixHandle operator precedence with a stack
min and extra stateStore pairs on a stackTrack the running minimumPush a value and a minPop and restore the previous minTrack extra state alongside values
undo and simulationTreat pop as undo of pushReplay a log of stack operationsUndo the last mutationSimulate a process with a stackCheckpoint and rollback a stack
two stacksUse two stacks togetherTransfer from one stack to anotherImplement a queue with two stacksCompare two stack topsSplit work between two stacks
call stackSee recursion as a stackPush a frame on a callPop a frame on returnRead the current frameConvert recursion to an explicit stack
next greater with a stackFind the next greater with a stackFind the next smaller with a stackScan left to right pushing indicesWrite answers when poppingHandle no greater as a sentinel
decoding nested repeatsDecode a nested repeat stringPush counts and fragmentsExpand when a closer arrivesBuild output from popped pieces
collisions and survivorsResolve opposing items with a stackPop while the top losesPush survivorsLeave equal-strength annihilation
copy and compare stacksCopy a stackCompare two stacksCopy without reversingProve a stack copy does not share storage
complexity for stacksRecognize O(1) push and popRecognize amortized O(n) pop-whileCount extra space of a stackAvoid scanning under the topCompare array vs list stack costs
problem decomposition for stacksRecognize a LIFO dependencyDecide what to store on the stackDecide values vs indices vs pairsIdentify matching-opener problemsIdentify next-greater problemsDraw the stack after each operation