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 01 · DSA · The toolbox · about 18 min to read

Play it as a journeyTutor comes with a plan

Arrays & Strings

Arrays and Strings
Arrays and Strings · Open board

One row of same-size boxes, then two ways of walking it that turn a nested loop into a single pass. Builds on Complexity & Big-O and The Memory Hierarchy (cache, locality, the memory wall).

Before you start. You need Complexity & Big-O‘s two words: O(1) means the cost never changes as the pile grows, O(n) means it climbs in step with it. Every trick below is about touching as few boxes as possible.

Lesson 3 of 96 in DSA · Free with an account

Keep reading. It's 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.

No card, and chalk sends no email. Google sign-in only.

Start free with Google

In this lesson

  • A street where every house has a number
  • 1945: von Neumann’s row of numbered boxes
  • Adding to the end is free. Adding in front costs everyone.
  • 1972: Ritchie’s one-byte decision
  • Two fingers, walking toward the middle
  • A window that grows and shrinks
  • Asking about a range, over and over
  • The array and the dynamic array
  • Strings are arrays of characters
  • Two-pointer, measured
  • Sliding window & prefix sums, measured

Terms it explains: array, immutable, two pointers, sliding window, prefix sum, O(1) random access, dynamic array, capacity, amortized O(1), immutability, O(n²), KMP, Floyd's tortoise & hare, fixed window, variable window, Prefix sums, capacity vs length, fixed vs variable window, Floyd's cycle detection, in-place, string, StringBuilder / join, two-pointer.

Review DSA