Academy
Data Structures
6 pages · about 81 min of reading
- 01Linked lists, singly and doublyWhy a linked list trades O(1) lookup for O(1) insertion, the sentinel, reversal and cycle-detection patterns interviewers ask for, and when it actually beats an array.
- 02Stacks and queues, LIFO and FIFOTwo disciplines built on the same array, why the call stack and the event queue are named what they are, and the monotonic-stack and two-stack patterns.
- 03Hash tables: hashing and collisionsHow a key becomes an array index, why collisions are the design, the counting and grouping patterns behind half of all interview questions, and what Map and dict do.
- 04Trees, tries, and traversal orderA hierarchy instead of a chain, the four traversal orders and when each applies, how a binary search tree stays fast, and the tree keyed by character.
- 05Heaps and priority queuesA tree that lives in a flat array, the one invariant that makes "give me the smallest" an O(log n) operation, and why sorting everything is the wrong tool for "top k".
- 06Graphs: BFS, DFS and topological sortNodes and edges instead of a fixed shape: BFS for shortest paths, DFS to flood a grid, topological sort for dependencies, and union-find for connectivity.