edubun
English
Programming · 7 units · about 191 min · 77 practice questions

Algorithms

Seven units on the methods behind searching, sorting and finding a way through a maze: Euclid's algorithm, linear and binary search, five sorting methods, Big O notation, recursion with the Tower of Hanoi, and breadth-first and depth-first search. Each unit has a lab that runs the algorithm one step at a time and counts its comparisons, JavaScript exercises checked in the page, flashcards and 10 to 12 practice questions with explanations.

Progress
Start

What you will learn

  • Say what makes a list of steps an algorithm
  • Follow bubble, selection and insertion sort step by step
  • Split a problem, solve the halves, combine them
  • Write a function that calls itself, with a base case
  • Run breadth-first search with a queue

Units

  1. 1What an algorithm is18 pages30 minExplain3Explore4Problem8Practice2
  2. 2Searching: linear and binary search19 pages28 minExplain4Explore3Problem9Practice2
  3. 3Sorting 1: bubble, selection and insertion sort19 pages29 minExplain3Explore4Problem9Practice2
  4. 4Sorting 2: merge sort and quicksort20 pages28 minExplain5Explore3Problem9Practice2
  5. 5How fast? Big O notation20 pages25 minExplain6Explore1Problem10Practice2
  6. 6Recursion19 pages27 minExplain6Explore2Problem8Practice2
  7. 7Graph search: BFS and DFS18 pages24 minExplain4Explore2Problem9Practice2

About this course

An algorithm is a precise method with a clear input and a clear output, and the first habit the course teaches is to write both down before writing any code. For the greatest common divisor, the input is two positive whole numbers and the output is one whole number that divides both, with no larger number doing the same. The first method you meet is Euclid's, and you count how many divisions it needs for 1071 and 462. The course also mentions Ada Lovelace, whose last note on Charles Babbage's unbuilt Analytical Engine, Note G, sets out step by step how the machine could compute Bernoulli numbers.

A common mistake is recursion without a stopping case. Each waiting call takes stack space, and in Chrome and Node.js the result is RangeError: Maximum call stack size exceeded.

Before you start

Each unit includes JavaScript exercises checked in the page, so JavaScript is the natural place to start: loops, arrays and functions all appear here. Comfort with powers of 2 and simple logarithms also helps when the course counts the checks binary search needs.

Course map

Programming · Courses: 4
Sources for this course (11)
  • MIT OpenCourseWare 6.006 Introduction to Algorithms, Spring 2020 (Demaine, Ku, Solomon)
  • lecture notes 1 Introduction, 3 Sorting, 9 Breadth-First Search, 10 Depth-First Search (ocw.mit.edu/courses/6-006-introduction-to-algorithms-spring-2020/pages/lecture-notes) and Fall 2011 lecture 13 BFS notes (ocw.mit.edu/courses/6-006-introduction-to-algorithms-fall-2011)
  • Cormen, Leiserson, Rivest, Stein, Introduction to Algorithms (MIT Press)
  • with the CLRS-based Khan Academy algorithms unit by Thomas Cormen and Devin Balkcom of Dartmouth (khanacademy.org/computing/computer-science/algorithms: binary search, selection sort analysis, merge sort, quicksort overview and analysis)
  • MacTutor History of Mathematics, Al-Khwarizmi (mathshistory.st-andrews.ac.uk/Biographies/Al-Khwarizmi: word algorithm from the Latin title Algoritmi de numero Indorum)
  • D. E. Joyce, Euclid's Elements Book VII Propositions 1 and 2 (mathcs.clarku.edu/~djoyce/elements/bookVII)
  • Wolfram MathWorld, Merge Sort (mathworld.wolfram.com/MergeSort.html: proposed by John von Neumann in 1945, after Knuth 1998 p. 159)
  • Stanford CS "Tony Hoare: Quicksort" (cs.stanford.edu/people/eroberts/courses/soco/projects/2008-09/tony-hoare/quicksort.html: devised while a student at Moscow State University for Russian-English machine translation with a tape dictionary, programmed in Algol 60 and published 1961; the year 1959 from the Wikipedia Quicksort article and its cited sources)
  • Bodleian Libraries, Ada Lovelace (blogs.bodleian.ox.ac.uk/adalovelace: 1843 paper, Note G Bernoulli numbers)
  • Fourmilab text of Menabrea's Sketch with Lovelace's notes (fourmilab.ch/babbage/sketch.html)
  • Seven Bridges of Konigsberg (Euler 1736) and Tower of Hanoi (Edouard Lucas, 1883) checked against the Wikipedia articles and their cited sources.

Checked: 2026-10-17