Skip to main content

Data Structures & Algorithms Study Guide

The whole course, unit by unit

Eight units from asymptotic analysis through the core structures to greedy, dynamic programming, and complexity classes. Each unit explains what to know, how to apply it, what typically goes wrong, and one study move that makes the material stick.

Eight units

Foundations and analysis, array and string patterns, linear structures, hashing and heaps, trees, graphs, sorting, then algorithm design.

No single exam

Assessment is by implementation, timed problem solving, and explanation, mirroring how the material is used later.

Prerequisite

Comfortable programming in one language, including arrays, loops, and recursion.

Where it leads

University data structures courses, competitive programming, and technical interviews.

Units

The eight units

Unit 1 is the largest by a wide margin. The rest move faster, and the last one is the bridge into calculus.

1

Unit 1 · Foundational

Foundations and Analysis

The vocabulary for comparing solutions. Without asymptotic reasoning every later unit collapses into opinion about which approach feels faster.

Big-OBig-ThetaRecurrenceCall stackOverlapping subproblemsDecomposition
2

Unit 2 · Highest leverage

Arrays, Strings, and Pattern Techniques

The four patterns that solve a disproportionate share of problems. Recognising which one applies is worth more than any amount of implementation speed.

Prefix sumTwo pointersSliding windowMonotonicAnswer spaceContiguous
3

Unit 3 · Moderate

Stacks, Queues, and Linked Structures

Structures defined by a restriction. The restriction is what makes each one fit a specific class of problem, so recognising the fit is the skill rather than the implementation.

LIFOFIFODequeNodeReferenceFast and slow pointers
4

Unit 4 · Heavy

Hash Tables, Heaps, and Priority Structures

Two structures that trade ordering for speed. Hashing gives constant average lookup by abandoning order entirely; a heap keeps only enough order to expose the extreme element.

Hash functionCollisionChainingProbingLoad factorHeap property
5

Unit 5 · Heavy

Trees and Balanced Search Structures

Ordering that supports fast search, but only while the shape stays balanced. The caveat is the unit, and self-balancing structures exist entirely to enforce it.

In-orderPost-orderBST propertyBalanceRotationTrie
6

Unit 6 · Heavy

Graphs and Network Algorithms

The most general structure, and the one where representation choice changes the complexity of everything built on it. Many problems that do not look like graphs become easy once modelled as one.

VertexEdgeAdjacency listBFSDFSDijkstra
7

Unit 7 · Moderate

Sorting Algorithms

A small set of algorithms used as a lens for comparing time, space, and stability. The comparison matters more than any single implementation.

Lower boundStableIn placePivotPartitionCounting sort
8

Unit 8 · Culminating

Advanced Algorithm Design

Choosing a strategy rather than a structure. The central discrimination is when a greedy choice is provably safe and when overlapping subproblems force a table instead.

Greedy-choice propertyOptimal substructureMemoizationTabulationStatePruning

Mathematical Practices

The habits that run through every unit

Four habits this track assesses: classifying the problem, stating the complexity, testing degenerate input, and explaining the approach aloud.

1. Classify before you code

Most problems belong to a small number of patterns. Asking whether this is a two-pointer, sliding-window, hashing, or graph problem before writing anything saves more time than any coding speed.

2. State the complexity out loud

Say the time and space cost, and which case you mean, before you consider a solution finished. If you cannot state it, you do not yet understand your own solution.

3. Test the degenerate case

Empty input, one element, all duplicates, already sorted. These break more submitted solutions than any interesting case does.

4. Explain it to someone

A solution you can implement but not explain will fail an interview and usually hides a gap. Narrate the approach before writing the code.

Assessment

How to answer, not only what to know

Two lists: one for selected-response work, one for anything you have to write out.

Multiple choice

  • Drop constants and lower-order terms before comparing two costs.
  • Name the case. Hashing, quick sort, and binary search trees differ sharply between average and worst.
  • For traversal questions, identify whether the structure in use is a stack or a queue; that alone settles depth-first versus breadth-first.
  • Check preconditions. Binary search needs sorted input, and Dijkstra needs non-negative weights.
  • On recursion questions, find the base case first and check it is reachable.

Written work

  • State the approach and its complexity before writing code.
  • Handle empty, single-element, and duplicate-heavy inputs explicitly.
  • Justify the structure you chose by naming the operation that had to be fast.
  • If you use a known pattern, name it. Recognition is part of what is being assessed.
  • When you trade extra memory for speed, say so deliberately rather than leaving it implicit.

Study plan

Where the time is best spent

Four moves, in the order that pays off.

1

Learn the cost table cold

Insertion, deletion, search, and access for every structure, with the case. This table is the vocabulary for everything else and is worth rote learning.

2

Drill the four array patterns

Prefix sums, two pointers, sliding window, and binary search cover a large share of problems. Recognising them on sight is the highest-leverage skill in the course.

3

Implement each structure once

Write a stack, queue, hash map, binary search tree, and heap from scratch. Nothing else builds the same intuition for their trade-offs.

4

Practise explaining

For every problem you solve, say the approach aloud in under a minute. This is a separate skill from solving and it is assessed separately.

5

Separate greedy from dynamic programming

Knowing when a greedy choice is safe, and when overlapping subproblems force a table, is the main discrimination of the final unit.

6

Mix problems late

Practising one pattern at a time hides the real difficulty, which is recognising which pattern applies with no label attached.

Curriculum scope

What this sequence includes

Every unit answers the same two questions: what does this structure make cheap, and what does it make expensive. Choosing correctly is the skill; implementing is the exercise. The course therefore asks constantly for a justification rather than a working program alone.

Algebra and trigonometry core

Essential foundations

  • Asymptotic analysis, recurrences, and reasoning about growth
  • Array and string patterns: prefix sums, two pointers, sliding window, binary search
  • Stacks, queues, and linked structures, and the cost of pointer work
  • Hash tables, heaps, and priority structures
  • Trees, traversals, binary search trees, and balance
  • Graph representation, traversal, shortest paths, and spanning trees
  • Sorting algorithms compared by time, space, and stability
  • Greedy strategies, dynamic programming, backtracking, and complexity classes

Breadth beyond the assessed core

Included in this sequence

  • Recognising which pattern a problem belongs to before coding
  • Explaining a solution aloud, as an interview requires
  • Trading time against space deliberately
  • Knowing when a problem is likely intractable

Varies by course

Compare with the school syllabus

  • Language. Java, Python, and C++ are all used; the ideas transfer and the constant factors do not.
  • Advanced structures. Segment trees, tries, and union-find appear in some tracks and not others.
  • Contest emphasis. Some students take this alongside competitive programming and want heavier practice on patterns.

Glossary

Terms worth being precise about

Amortised cost

The average cost per operation across a sequence, used when one operation is occasionally expensive.

Monotonic

Consistently non-increasing or non-decreasing, which is the property two pointers and answer-space binary search rely on.

Load factor

Entries divided by buckets in a hash table, which predicts collision frequency.

Stability

A sort is stable when equal keys keep their original relative order.

In place

Using only constant extra space beyond the input.

Optimal substructure

An optimal solution is built from optimal solutions to subproblems.

Greedy choice property

The locally best choice leads to a globally optimal solution, which must be proved rather than assumed.

Memoization

Caching subproblem results on demand during a recursion.

Tabulation

Filling a table of subproblem results in dependency order.

NP-complete

In NP and at least as hard as everything in NP, with no known polynomial algorithm.