Math for CS Review
Memorize
These are things you need to memorize.
- Order of operations: first parenthesis, then exponents, then multiplication/division/modulus, then addition and subtraction. And left to right.
- Powers/exponents
- 210 = 1024, roughly 1 thousand
- 2a+b = 2a * 2b
- ya+b = ya * yb
- 2-a = 1 / (2a)
- 220 = 1024 × 1024, roughly 1 million
- 230 = 1024 × 1024 × 1024, roughly 1 billion
- Logarithms
- logbx = y, means by = x, for any b > 1
- log101000 = 3
- log21024 = 10
- logbx = logcx / logcb, for any b > 1, c > 1
- log210 is about 3.32
- logb(xy) = y logb x, for any b > 1
- Formulae
- Arithmetic Sum: (1 + 2 + ... + n) = n * (n+1) / 2
- Geometric Sum: 1 + r + r2 + r3 + ... + rn = (rn+1-1) / (r-1)