Search Algorithms: an interactive course
Search Algorithms is an interactive search algorithms course about finding things in data quickly. Its 24 short sections cover linear search, binary search and why it needs sorted data, counting steps, Big O notation, hash tables and collisions, trees and graphs, and depth-first and breadth-first search, with an animation or practice question in most of them.
Along the way it teaches the most useful idea in algorithms: measuring how the number of steps grows as the data grows, so you can tell which approach will still be fast with a million items.
What the course covers
| Sections | Topic | What you do |
|---|---|---|
| 1 to 4 | What a search algorithm is, and linear search | Race searches against each other, then count the checks a linear search makes |
| 5 to 9 | Binary search, and why the list must be sorted | Watch the range halve, pick the middle item, then spot lists that are not sorted |
| 10 to 11 | Counting steps | Find how many halvings a list of n items needs |
| 12 to 14 | Big O notation | Watch O(1), O(log n), O(n) and O(n²) pull apart as n grows, then match each to a task |
| 15 to 17 | Hash tables and collisions | Hash names into buckets, then find the bucket for a name |
| 18 to 22 | Trees, graphs, depth-first and breadth-first search | Watch DFS use a stack and BFS use a queue, then order the visits |
| 23 to 24 | Choosing the right search | Pick the best search for real situations |
Linear and binary search
Linear search checks items one by one, so it works on anything but may check every item. Binary search checks the middle of a sorted list and throws half away each time, so 32 items take at most 5 checks, because 2⁵ = 32. The course spends a section showing exactly how binary search goes wrong on an unsorted list. The AQA GCSE specification names these two searches and asks you to compare them.
Big O and hash tables
Big O notation describes how the steps grow: linear search is O(n), binary search O(log n). At a million items, log₂ n is only about 20. Hash tables go further, jumping straight to a key's bucket in O(1) on average, and the course shows what happens when two keys collide.
Trees and graphs
Not all data is a list. Depth-first search follows one branch as deep as it goes before backing up, using a stack. Breadth-first search visits a whole level before going deeper, using a queue, which is why it finds the nearest match first.
Try a question from the course
A linear search starts at the first item and checks each one in turn until it finds the target. In the list 4, 9, 2, 7, 5, 8, 1, 6, searching for 5 checks 4, 9, 2, 7 and then 5: five checks. Searching for 3, which is not there, checks all eight items before giving up.
Now count the checks for a new list, then press Mark to check your answer in the course.
Type how many checks linear search makes to find a target in a random list, or to give up.
Press Mark to have your answer marked in the Search Algorithms course.
Who this course is for
- GCSE and A-level computing students revising linear and binary search, Big O, hash tables and graph traversal.
- Beginner programmers preparing for coding interviews or university courses, who want the core ideas explained visually.
- Anyone who wants to know why some programs stay fast as data grows and others grind to a halt.
What you need to know first
The course page suggests Programming Languages first. The code examples are short JavaScript, and logarithms are explained as counting halvings, so no advanced maths is needed.
How long it takes
There are 24 sections, and most take a few minutes. Learners without a plan can open two sections of a course a day, in order, so the whole course takes 12 days. A plan removes the daily limit and lets you jump straight to any topic, such as BFS and DFS. For more depth on single topics, see the binary search trees, hash tables and sorting algorithms guides.
Common questions
Is this search algorithms course free?
What is the difference between linear and binary search?
Why must a list be sorted for binary search?
What is Big O notation?
What is the difference between BFS and DFS?
Does the course cover sorting algorithms?
Revision cards
Say the answer first, then flip the card to check it.
Where to go next
- Solve it
Algorithm Visualiser
Watch sorting and pathfinding algorithms run step by step
Open the tool - Learn it
Search Algorithms
Linear, binary, depth-first and beyond: find data fast with the right algorithm
Start the course - Test it
GCSE Computer Science
A new exam-style paper every day, with instant marking and a mark scheme
Start today's paper