DSA Foundations · Free course

Data structures & algorithms

Start with an array index. Work up to graph traversal and dynamic programming in 19 interactive labs, each paired with a coding exercise.

0 of 100 coding exercises solved on this device

Exercises solved by language

C
— / 100
C++
— / 100
Python
— / 100
Java
— / 100

Loading language totals…

Try binary search

Can you find 23?

Seven hidden numbers, sorted low to high. Flip a tile to decide where to look next.

Start in the middle. If the tile is below 23, you can skip everything to its left.

Learn DSA through games

Loading game progress…

Course map

6 stages · 19 interactive labs

Stage 1Lookups and running time5 labs

What do you know at the start of a lookup? Try an index, a value to search for, a link and a key.

  1. Array indexesPractice · Right Rotation
  2. Linear searchPractice · Largest Array Element
  3. Big O and counting comparisonsPractice · Factorial
  4. Linked listsPractice · Build a singly linked list
  5. Hash tablesPractice · Hash table
Try the stage challenge

Stage 2Strings and two pointers3 labs

Count repeated characters, walk inward from both ends of a string, and combine two sorted lists.

  1. Character frequencyPractice · Counting a Character
  2. Reversing with two pointersPractice · String Reversal
  3. Merging sorted arraysPractice · Merging Sorted Arrays
Try the stage challenge

Stage 3Sorting, heaps and search4 labs

Put values in order, then use one comparison to rule out a whole range or branch.

  1. Bubble sortPractice · Mergesort
  2. Min-heap insertionPractice · Min-heap insertion
  3. Binary searchPractice · Binary search
  4. Binary search treesPractice · Validate a binary search tree
Try the stage challenge

Stage 4Stacks and recursion2 labs

An editor remembers which change to undo. A recursive function remembers which call to resume. Trace the most recent unfinished item in each.

  1. StacksPractice · Stack
  2. RecursionPractice · Solve the Tower of Hanoi
Try the stage challenge

Stage 5Queues and graph traversal3 labs

Follow one branch of a graph in depth. Then use a queue to find a route with the fewest stops.

  1. QueuesPractice · Queue
  2. Depth-first searchPractice · Depth-first search on a graph
  3. Graph traversalPractice · Shortest paths with BFS
Try the stage challenge

Stage 6Backtracking and dynamic programming2 labs

Build every possible selection, then see how saving a smaller answer can avoid repeated work.

  1. Backtracking with subsetsPractice · Generate subsets
  2. Dynamic programming with FibonacciPractice · Fibonacci sequence
Try the stage challenge

Saved drafts

Loading saved drafts…