ASAPUtils Logo ASAPUtils

DSA Topics

Every data structure, algorithm pattern, and foundation unit in the ASAPUtils DSA curriculum, with step-by-step visualizers and C++ plus JavaScript implementations.

Foundations

The state-simulation skill everything else sits on. Do these first, even though they look basic.

Data structures

What each structure physically is, its invariant, and how you travel it.

Patterns

Signal → template → why it works. This is what makes an unseen problem solvable.

Two Pointers
Two indices walking a sorted array from opposite ends, discarding half the remaining possibilities at every step. The template is four lines — the part worth learning is the argument for why discarding is safe.
Week 1
Frequency Counting
Count first, then answer the question. The pattern behind anagrams, duplicates, top-k, and grouping — plus when a 26-slot array beats a hash map and when a canonical key beats both.
Week 1
Sliding Window (Fixed Size)
When the window size never changes there is no shrink loop — one element enters and one leaves on every step. The simpler half of the sliding window family, and the right place to start.
Week 2
Sliding Window (Variable Size)
Expand right always, shrink left while invalid, record when valid. One template covers longest-substring, character replacement, and minimum window — the only thing that changes is the definition of invalid.
Week 2
Prefix Sums
Precompute running totals so any range sum becomes one subtraction. The pattern that answers many range queries in O(1) each, and the one that rescues subarray problems when negative numbers break the sliding window.
Week 2
Monotonic Stack
Recognize next-greater, next-smaller, span, and histogram problems; learn the increasing and decreasing stack invariants; and understand why nested pop loops still run in O(n) across the full algorithm.
Week 3
Binary Search
Learn binary search through interval invariants, exact lookup and boundary templates, overflow-safe midpoint calculation, rotated arrays, virtual indexing, and common off-by-one failures in C++ and JavaScript.
Week 4
Binary Search on the Answer
Turn optimization problems into monotone feasibility checks, choose safe numeric bounds, and find the minimum feasible or maximum feasible answer with reusable C++ and JavaScript binary-search templates.
Week 4
Sorting and Comparators
Learn when sorting is the optimization, what ordering buys, stable versus unstable behavior, numeric and custom comparators in C++ and JavaScript, and the strict-order rules that prevent subtle interview bugs.
Week 4
Cyclic Sort and Index Placement
Learn the O(n), O(1)-space index-placement pattern for arrays containing values from 1 through n, including missing and duplicate variants, loop invariants, safe swaps, and C++ plus JavaScript templates.
Week 4
Fast and Slow Pointers
Master Floyd's fast-and-slow pointer pattern for cycle detection, cycle entrances, linked-list middles, and fixed gaps from the end, with proofs, C++ and JavaScript templates, and step-by-step traces.
Week 5
In-Place Linked-List Reversal
Learn the prev-curr-next reversal invariant for whole lists, sublists, and fixed-size groups, including safe pointer ordering, reconnection rules, C++ and JavaScript templates, and interactive link traces.
Week 5