- Algorithms
- Helper structures
Helper structures
Simple data structures that keep track of pending work inside an algorithm.
1 guides12 min in totalAlgorithms
The guides, in order
Read them top to bottom: each one builds on the ones before. The ones you've read carry a check.
About this group
- What you'll find
- When to use a stack for whatever is still open, like unclosed brackets, and a ring buffer to keep the last k values.
- It's for you if…
- you see bracket problems, "next greater element" or windows of recent values and don't recognise the pattern.
- How each guide works
- Each guide starts with the intuition and the signs that tell you to use the technique, then the steps and its time and memory cost. It includes a step-by-step traced example, code in TypeScript, Python and PHP, variants, common mistakes and frequently asked questions.
More groups in Algorithms
- Search and sortTechniques for finding things fast: swapping a nested loop for a map, sorting first or halving the search space.See the 3 guides
- Pointer traversalsWays to walk an array or a string once by moving two indexes carefully. They solve many problems about pairs, subarrays and substrings.See the 2 guides