Maths
These mathematical tools explain the bounds, indexing, and numeric transformations used throughout the book. Learn the operation and its cost, not just the name.
Fundamentals
- Binary exponentiation — compute in multiplications by repeatedly squaring.
- Number representation — convert between binary, decimal, hexadecimal, signed, and unsigned values.
- Bit shifting — multiply or divide powers of two when the operation preserves the intended sign and range.
- Logarithms and bases — count how many times an input can be halved or how many levels a branching process creates.
Prime numbers
- Sieve of Eratosthenes — find all primes up to in time and space.
Algebra
- Fibonacci numbers — a recurrence used for dynamic programming and recurrence analysis.
- Golden ratio — the limiting ratio in Fibonacci growth and several divide-and-conquer bounds.
- Euclidean algorithm — compute a greatest common divisor with repeated remainders.
- Euler’s totient function — count integers relatively prime to a given integer.
- Catalan numbers — count recursively defined structures such as binary trees and valid parentheses.
Identities to remember
- , so changing a constant logarithm base does not change a Big-O class.
- .
- .
- , which is the basis of the Euclidean algorithm.