Curriculum map

A practical DSA roadmap for coding interviews.

Learn the structures that hold information, the algorithms and patterns that move through them, and the analysis skills that help you choose between valid solutions.

Separate the container from the movement.

A data structure describes how information is organized and what operations are cheap. An algorithm describes the steps used to produce an answer. An interview pattern is a reusable shape for those steps. A graph can be stored as an adjacency list; DFS and BFS are two different ways to traverse it.

A useful question

What does this structure make cheap, and what does it make expensive? That answer often explains why one algorithm fits better than another.

1. Build the data-structure foundations

Sequence

Arrays & strings

Direct indexing is usually O(1). Full scans are O(n). Inserting or removing in the middle may require shifting values.

Lookup

Hash maps & sets

Use keys for fast expected lookup, frequency counting, membership, grouping, and remembering what you have seen.

Linear links

Linked lists, stacks & queues

Follow nodes, remember unfinished work with a stack, or preserve arrival order with a queue.

Hierarchy

Trees

Practice recursive structure, subtree questions, traversal orders, and the difference between height and number of nodes.

Relationships

Graphs

Represent vertices and edges, prevent repeated visits, find connected components, and reason about paths.

Priority

Heaps

Keep the next minimum or maximum accessible while values enter and leave, often in O(log n) per update.

Complexity changes with the representation

For a graph, an adjacency list lets a traversal inspect the neighbors that actually exist, leading to O(V + E) work. An adjacency matrix may require scanning a full row of possible neighbors for every vertex, which can move toward O(V²). The abstract graph is the same; the representation changes the work.

2. Learn the movement patterns

Once the structures are familiar, focus on how state moves through them.

PatternMain stateProgress
Two pointersTwo useful positionsMove the side that removes impossible work
Sliding windowRange boundaries plus window stateAdd what enters, remove what leaves
Binary searchLeft, right, and middleDiscard one impossible half
DFSCall stack or explicit stackFinish one branch before returning
BFSQueue and visited setFinish one distance layer before the next
BacktrackingCurrent candidate and choicesChoose, explore, undo, prune
Dynamic programmingState definition and stored answersBuild from smaller overlapping subproblems

The same pattern can appear on different surfaces. DFS can explore a tree, a graph, a grid, or an implicit state space. Sliding window can track a sum, a frequency map, a count of invalid items, or another compact summary of a contiguous range.

3. Practice the strategy layer

Clarify

Restate the input, output, constraints, and edge cases before committing to an approach.

Compare

Name a simple solution first, then identify the repeated or unnecessary work an optimized pattern removes.

Outline

Describe initialization, the main loop or recursion, state updates, termination, and return value.

Analyze

Count the dominant work and the helper storage that grows with the input.

Big-O is part of the explanation, not a label added at the end. If you say O(n), you should be able to explain what enters the scan once. If you say O(log n), you should be able to identify what is halved each round.

Read the practical Big-O guide →

A sensible DSA study order

  1. Arrays, strings, hash maps, and sets: build comfort with indexing, scans, counts, and lookup.
  2. Two pointers, sliding window, and binary search: practice loop invariants and boundary movement.
  3. Linked lists, stacks, queues, trees, and recursion: learn references, call stacks, and hierarchical state.
  4. Graphs, DFS, and BFS: add visited state, components, layers, and representation choices.
  5. Heaps, intervals, greedy, and backtracking: compare priority, ordering, local choices, and search trees.
  6. Dynamic programming: define state and transitions after recursion and overlapping subproblems feel concrete.
  7. Mixed review: practice recognition without being told the topic and revisit mistakes with spacing.
Do not wait to practice

After each new concept, solve a small set of focused problems and explain the invariant in your own words. Breadth without retrieval practice fades quickly.

A curriculum in your pocket

Learn, practice, and revisit the patterns on iPhone.

Cozytek Code combines visual lessons, interview-style problems, mastery checks, solution guides, and private progress tracking.

Download on the App Store