Index

Free, with Google

Keep going, free.

A free account opens lessons 2 and 3 of every track, 33 more lessons, and keeps your progress and review cards on every device.

Start free with Google

A chalk plan

Open everything on chalk.

Every lesson, board, video, lab and paper, and the full review decks. Yearly is $39/year.

See plansStart free instead

Module 03 · DSA · Worked, and deeper · about 22 min to read

Play it as a journeyTutor comes with a plan

The clock that wraps around

Thinking in Bits
Thinking in Bits · Open board

Shows a number as a fixed row of switches. This lesson is what happens when the row runs out, and the arithmetic that turns running out into a tool.

Before you start. Bit Manipulation (thinking in bits) showed that a computer stores a whole number as a row of 1s and 0s, and that the row has a fixed length, often 32 switches. Keeping only the last three digits after every multiply still lands on the right last three digits. Complexity & Big-O called a cost that grows by one step per doubling of the input O(log n).

Lesson 28 of 96 in DSA

The rest of this lesson is part of a plan.

A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year.

See plansAlready a member? Sign in

Or start free: a free account opens lessons 2 and 3 of every track.

In this lesson

  • 1 May 2015: a Boeing 787, and a counter that overflows after 248 days
  • The counter is a clock face: overflow and the modulus
  • Which hours can a step reach? The greatest common divisor
  • Undoing a step: the modular inverse
  • Clocks where every step undoes: primes, and the sieve
  • The 248 days, and the wrap itself
  • Reduce early, or the modulus arrives on its own
  • Euclid, traced and timed
  • Extended Euclid, and the inverse
  • The sieve against one-at-a-time
  • First time in an interview: the path

Terms it explains: O(log n), overflow, modulus, greatest common divisor, modular inverse, sieve, 10 stored ->", f"{as_int32(10, 61 - 1, 10, 5, 10, Count Primes, Reverse Integer, Count Anagrams.

Review DSA