Stack
A stack is a linear data structure that follows Last-In-First-Out (LIFO) ordering: elements are added and removed from the same end, called the top, so the most recently inserted element is the first one removed. Core operations — push, pop, and peek — all run in O(1), making stacks fundamental to function call…
21 resources across 4 libraries
Glossary Terms(5)
Tree
A tree is a hierarchical, non-linear data structure consisting of nodes connected by edges, with one node designated as the root and every other node having ex…
Graph
A graph is a data structure consisting of a set of nodes (vertices) connected by edges, which may be directed or undirected and weighted or unweighted, used to…
Heap
A heap is a specialized tree-based data structure that satisfies the heap property: in a min-heap, every parent node is less than or equal to its children; in…
Queue
A queue is a linear data structure that follows First-In-First-Out (FIFO) ordering: elements are added at the rear (enqueue) and removed from the front (dequeu…
Stack
A stack is a linear data structure that follows Last-In-First-Out (LIFO) ordering: elements are added and removed from the same end, called the top, so the mos…
Study Notes(6)
Lua and C Interop
How Lua's stack-based C API lets Lua scripts call C functions and C programs embed and drive a Lua virtual machine in both directions.
Installing GHC and Stack
How to set up a working Haskell toolchain -- GHC, Cabal, Stack, and HLS -- using GHCup, and the daily commands you'll use to build and run projects.
The Stack in Assembly
Understand how the x86 stack, ESP, EBP, CALL, RET, and calling conventions work together to manage function calls, local variables, and register preservation.
The ELK Stack Overview
A tour of Elasticsearch, Logstash, and Kibana (plus Beats) as a combined stack for ingesting, storing, and visualizing log and event data.
Stack Implementation in C
Master array-based stack implementation in C with push, pop, peek, overflow/underflow checks, and full working code.
Nested Navigation and the Back Stack
How to group related destinations into nested navigation graphs, control back stack behavior with popUpTo, and manage multi-flow apps cleanly.
Cheat Sheets(1)
Interview Questions(9)
Difference Between Stack and Queue
A stack is a LIFO (Last In, First Out) structure where the last element added is the first removed, while a queue is a FIFO (First In, First Out) structure whe…
BFS vs DFS: What is the Difference?
BFS (breadth-first search) explores a graph level by level using a queue, while DFS (depth-first search) explores as deep as possible along one path before bac…
How Do You Solve the Valid Parentheses Problem?
The valid parentheses problem is solved with a stack: push every opening bracket you encounter, and on every closing bracket, check that the stack's top is the…
Next Greater Element: How Do You Solve It?
The next greater element problem is solved with a monotonic decreasing stack: scan the array left to right keeping the stack's values in decreasing order, and…
What is the Monotonic Stack Technique?
A monotonic stack is a stack that is kept either strictly increasing or strictly decreasing from bottom to top by popping any element that would violate that o…
How Would You Implement a Stack Using Queues?
A stack (LIFO) can be built from one or two FIFO queues by rotating the queue after every push so the newest element sits at the front, which makes push O(n) a…
How Would You Implement a Queue Using Stacks?
A queue (FIFO) can be built from two stacks: an 'in' stack absorbs every enqueue in O(1), and an 'out' stack is refilled by popping everything off 'in' and pus…
How Would You Design a Min Stack?
A min stack supports push, pop, top, and getMin all in O(1) by maintaining a second, auxiliary stack that tracks the minimum value at each point in the main st…
How Would You Evaluate Reverse Polish Notation?
Reverse Polish Notation (postfix) is evaluated in a single left-to-right pass using a stack: push every number, and whenever an operator is seen, pop its two m…