Python Arena

Module 59 Extra

Complexity and searching

How the work of a program grows with its input, in Big-O, and the classic ways to make it grow slower. Sets and dicts that trade memory for speed, binary search and the bisect module, two pointers on sorted data, prefix sums and sliding windows, each with tests big enough that a slow way runs out of time.

Steps

  1. Big-O in practice
  2. Sets and dicts for speed
  3. Binary search
  4. Two pointers
  5. Prefix sums
  6. Challenge: sliding windows