
Week 2, Tuesday (Video)
January 13, 2026
We now have two pillars:
Consider \(T(n) = 3n^2 + 5n + 7\). What happens when \(n\) doubles?
| Class | When \(n\) doubles, time… |
|---|---|
| \(O(1)\) | stays the same |
| \(O(\log n)\) | increases by a constant |
| \(O(n)\) | doubles |
| \(O(n \log n)\) | slightly more than doubles |
| \(O(n^2)\) | quadruples |
| \(O(2^n)\) | squares (!!) |
“No matter how big the input, same time.”
Worst case: \(\Theta(n^2) \to \Theta(n)\)
The set provides \(O(1)\) lookup.
Small data: write clear code.
Big data: Big-O is destiny.
Both touch every row: \(O(n)\)
But: