Start with the foundation
Learn complexity before collecting algorithms
Big O notation gives you a language for comparing solutions. Learn how loops, nested work, recursion, and common collection operations affect time and space before memorizing named algorithms.
Use tiny inputs and count operations by hand. The goal is to predict how a solution behaves when the input grows.

A connected sequence
Follow dependencies in the right order
Begin with arrays, strings, hashing, linked lists, stacks, and queues. Continue to recursion, binary search, sorting, trees, heaps, graphs, greedy methods, backtracking, and dynamic programming.
Solve several small problems after each structure. Mixing every topic at once makes patterns harder to recognize.
- Arrays, strings, and hashing
- Pointers, linked lists, stacks, and queues
- Trees, heaps, and graphs
- Greedy, backtracking, and dynamic programming
Turn knowledge into recall
Practice by pattern, then under constraints
Group questions by reusable patterns such as two pointers, sliding windows, prefix sums, monotonic stacks, and graph traversal. Explain the invariant before writing code.
After solving, record the idea, complexity, edge cases, and one mistake you made. Revisit the problem without looking at the old solution.
def two_sum(nums, target):
seen = {}
for index, value in enumerate(nums):
need = target - value
if need in seen:
return [seen[need], index]
seen[value] = index
return []
Continue learning
Build the complete mental model with the visual lessons, examples, and practice material in the DSA with C++ course.
Explore the course