All paths

Data structures and algorithms

The ideas every programmer is asked about, built and measured on an Uno: big O, linked lists, stacks and queues, hash maps, sorting and binary search. Ends with a leaderboard that needs them all.

Arduino Uno R3Free7 lessons6 h4 chapters3,199 XPCoding · Advanced+250 XP

0 of 7 done

What you will build

3 projects, built step by step

7 lessons in 4 chapters, about 6 hours on a simulated Arduino Uno R3. Free, in your browser, every step checked by the simulator.

Chapter 1 project

Linked lists

Nodes joined by pointers, taken from a fixed pool of 16 so nothing can fragment: add at the head, insert and delete in the middle, run the pool dry, and fix a reverse that leaks.

Open it in the simulator
Chapter 2 project

Hash maps

An 8 slot open-addressing table: a hash function turns a name into a home slot, collisions probe onward, tombstones keep chains whole, the load factor lights a lamp, and a better hash spreads the names out.

Open it in the simulator
Chapter 3 project

Searching and binary search

Linear against binary search on 100 sorted numbers with comparisons counted, a slow-motion search on the lamps, a guessing game in ten tries, and an off-by-one found by a self-test.

Open it in the simulator
The map

Chapter by chapter

Each lesson opens when the one before it is done, and each chapter ends in a project.

Chapter 1

What things cost

Arrays, big O, and lists made from a fixed pool of nodes.

  1. Open326 XP

    Arrays and big O

    One block of 64 ints: an index lookup that costs one step, a scan that costs up to n, a pair check that costs n squared over two, and a table that shows each cost as n doubles.

    0 of 7 steps

  2. ProjectLocked652 XP

    Linked lists

    Nodes joined by pointers, taken from a fixed pool of 16 so nothing can fragment: add at the head, insert and delete in the middle, run the pool dry, and fix a reverse that leaks.

    0 of 7 steps

Chapter 2

Structures with rules

Stacks, queues and a hash map: limits that make things fast.

  1. Locked326 XP

    Stacks and queues

    An array stack that matches brackets and undoes a running total, and a ring-buffer queue of lamp tasks fed by the serial monitor and the button. Then a stack that overflows, and the fix.

    0 of 7 steps

  2. ProjectLocked576 XP

    Hash maps

    An 8 slot open-addressing table: a hash function turns a name into a home slot, collisions probe onward, tombstones keep chains whole, the load factor lights a lamp, and a better hash spreads the names out.

    0 of 6 steps

Chapter 3

Put it in order, find it fast

Three sorts raced and counted, then binary search and its off-by-one.

  1. Locked326 XP

    Sorting

    Bubble, insertion and quick sort on the same 16 numbers with every comparison and swap counted, best and worst cases, stability shown with tags, a race to 64, and an early exit that makes bubble sort smart.

    0 of 7 steps

  2. ProjectLocked652 XP

    Searching and binary search

    Linear against binary search on 100 sorted numbers with comparisons counted, a slow-motion search on the lamps, a guessing game in ten tries, and an off-by-one found by a self-test.

    0 of 7 steps

Chapter 4

Boss

A leaderboard for a reaction game, built from the whole course.

  1. Locked341 XP

    Boss: a leaderboard

    A reaction game and its leaderboard built from the course: players in a hash map, a ranking kept sorted by one insertion pass, binary search for where a score would land, and a stable rule for ties.

    0 of 8 steps

Syllabus

Every lesson in the course

All 7 lessons, in order, each with what it covers. Any of them opens in the editor right away.

Chapter 1

What things cost

  1. Arrays and big OOne block of 64 ints: an index lookup that costs one step, a scan that costs up to n, a pair check that costs n squared over two, and a table that shows each cost as n doubles.
  2. Linked listsNodes joined by pointers, taken from a fixed pool of 16 so nothing can fragment: add at the head, insert and delete in the middle, run the pool dry, and fix a reverse that leaks.
Chapter 2

Structures with rules

  1. Stacks and queuesAn array stack that matches brackets and undoes a running total, and a ring-buffer queue of lamp tasks fed by the serial monitor and the button. Then a stack that overflows, and the fix.
  2. Hash mapsAn 8 slot open-addressing table: a hash function turns a name into a home slot, collisions probe onward, tombstones keep chains whole, the load factor lights a lamp, and a better hash spreads the names out.
Chapter 3

Put it in order, find it fast

  1. SortingBubble, insertion and quick sort on the same 16 numbers with every comparison and swap counted, best and worst cases, stability shown with tags, a race to 64, and an early exit that makes bubble sort smart.
  2. Searching and binary searchLinear against binary search on 100 sorted numbers with comparisons counted, a slow-motion search on the lamps, a guessing game in ten tries, and an off-by-one found by a self-test.
Chapter 4

Boss

  1. Boss: a leaderboardA reaction game and its leaderboard built from the course: players in a hash map, a ranking kept sorted by one insertion pass, binary search for where a score would land, and a stable rule for ties.
Keep going

The next course on your track

Data structures and algorithms is part of the coding track, a ladder of courses from zero to expert.

Next course

Software design and testing

How teams keep firmware right as it grows: readable code, modules behind narrow interfaces, fakes, tests on boot, test-first fixes, safe refactors and code review. Ends with a messy sketch refactored under test.

Open the next course
Track

Coding track

Python and C++ from your first print to classes, tests and state machines. Every program runs on a simulated board, so a bug is something you can see.

See every course on the track
Kits

Build it on your bench too

Every lesson runs in the simulator with nothing to buy. When you want the real thing, these kits have the parts.

Have a kit already?

Find your kit

Pick the starter kit you own and run every lesson in its manual with the same parts on the same pins.

See every kit
Questions

About Data structures and algorithms

Is Data structures and algorithms free?

Yes. All 7 lessons of Data structures and algorithms are free and run in your browser, with nothing to install and no parts to buy before you start.

Do I need a real Arduino Uno R3?

No. Every lesson runs on a simulated Arduino Uno R3 with its parts on the canvas, and the simulator checks each step as you go. When you want to build it for real, the same wiring and code work on a real board.

How long does Data structures and algorithms take?

About 6 hours: 7 lessons in 4 chapters, each one a few short steps. Your progress is kept, so you can stop after any lesson and pick up where you left off.

What will I build?

Each chapter ends in a project that puts it together: Linked lists, Hash maps and Searching and binary search.

Where do I start?

With "Arrays and big O", and each lesson builds on the one before it. New to circuits? Electronics basics is the course that starts from zero.