
U.C. Berkeley — CS170 : Algorithms, Spring 2014 Cheat Sheet
Professor: Elchanan Mossel Feb 20, 2014
Do not write on this page
•For two positive functions fand gdefined for positive integers:
–f=O(g)iff f(n)≤Cg(n)for some positive Cand all n>n0for some positive n0.
–f= Ω(g)if g=O(f)
–f= Θ(g)if f=O(g)and g=O(f)
•Euclid’s Algorithm: if a≥b > 0then gcd(a, b) = gcd(b, a mod b).
•Fermat’s Little Theorem: If pis prime then for every a: 1 ≤a<p,ap−1≡1 mod p.
•RSA
–Primes p, q;N=pq
–ed ≡1 mod (p−1)(q−1)
–Public key: (N, e). Private key: d.
–Encryption: x→xe. Decryption: y→yd.
•His universal hash function if for every two items xand y, exactly |H|/n of the functions map xand yto
the same bucket (n= number of buckets).
•Master Theorem: Given T(n) = aT (n
b) + O(nd),
T(n) =
O(nd)if d > logba
O(ndlog n)if d= logba
O(nlogba)if d < logba
•FFT-recursive: A(ωj) = Ae(ω2j) + ωjAo(ω2j),ω=e2πi/n,
•FFT-Matrix : Mn(ω)j,k =ωjk , for 0≤j, k < n. Inverse: Mn(ω)−1=1
nMn(ω−1).
1