Rescue a slow workload with the right algorithm
The real-world version of DSA: a workload is too slow in production, and the fix is a better algorithm or data structure, not more servers. You take a genuinely slow program (a graph traversal, a large-collection scan, or a quadratic pairwise computation), find the algorithmic bottleneck, redesign it to a better complexity class, and prove the win with hard before/after numbers.
What you'll build
A profiled, redesigned solution to a real slow workload with a benchmark showing a major, order-of-magnitude before/after improvement, a clear complexity argument explaining WHY the new approach wins, and an honest account of the trade-offs (memory, readability, preprocessing cost) you accepted.
See how we teach, before you sign up
You don't just get code dumped on you. Every starter file and every solution is explained line-by-line, in plain English. Here's one real file from this project:
def find_duplicate_pairs(items):
"""Return sorted list of (i, j) index pairs where items[i] == items[j]."""
pairs = []
n = len(items)
for i in range(n): # O(n)
for j in range(i + 1, n): # O(n) -> O(n^2) overall
if items[i] == items[j]:
pairs.append((i, j))
return sorted(pairs)Reading this file
for i in range(n):The outer loop, paired with the inner one it compares every item against every later item.for j in range(i + 1, n):The nested inner loop is what makes this O(n squared), the bottleneck you will redesign away.if items[i] == items[j]:The pairwise equality check, cheap individually but run n squared times, that is the real cost.return sorted(pairs)Returns a sorted result, the redesign must match this ordering exactly to pass the differential test.
The original O(n²) version, keep it intact as the correctness oracle.
That's 1 of 9 explained code blocks in this single project.
The build, milestone by milestone
- 1
Reproduce the slowness and find the real cost
5 guided stepsEngineers waste enormous effort optimizing code that isn’t the bottleneck. A profiler tells you where the time actually goes, which is almost never where intuition points.
- 2
Choose an approach that changes the complexity class
5 guided stepsMicro-optimizations shave constants; the real wins come from changing the complexity class, O(n²) → O(n log n), or repeated O(V·E) → preprocessed O(1) lookups. Choosing well, and being able to argue why, is the senior skill.
- 3
Implement the redesign and prove it’s correct
5 guided stepsA faster wrong answer is worthless. Before you celebrate the speedup, you must prove the redesign is behaviorally identical, fast and correct, in that order of trust.
- 4
Benchmark, then defend the win
5 guided stepsThe deliverable that makes this portfolio-worthy is the proof: a benchmark showing an order-of-magnitude win, an empirical complexity curve, and an honest account of what you gave up to get it.
- 5
Break it on purpose: stress the redesign with adversarial inputs
5 guided stepsAverage-case wins lie. A hash-based rescue collapses under adversarial collisions; a preprocessed index blows memory on a pathological graph. Production traffic eventually finds these, so you find them first, this is the chaos test for an algorithm.
- 6
Write the runbook and a blameless postmortem of the original
5 guided stepsThe rescue is only durable if the next engineer knows its limits and the team learns why the slow version existed at all. A runbook keeps it safe; a blameless postmortem keeps the same mistake from recurring.
What's inside when you start
You'll walk away with
This is portfolio-grade. Build it free.
Sign up to unlock every milestone step-by-step, the code skeletons, full reference solutions, and checkable tasks, with your progress saved as you build.
Start building