Docsity

UC Berkeley — CS170 : Algorithms, Spring 2014 Cheat Sheet, Lecture notes of Algorithms and Programming

Toggle sidebar
bg1
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

Partial preview of the text

Download UC Berkeley — CS170 : Algorithms, Spring 2014 Cheat Sheet and more Lecture notes Algorithms and Programming in PDF only on Docsity!

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 f and g defined for positive integers: - f = O(g) iff f (n) ≤ Cg(n) for some positive C and all n > n 0 for some positive n 0. - f = Ω(g) if g = O(f ) - f = Θ(g) if f = O(g) and g = O(f )
  • Euclid’s Algorithm: if a ≥ b > 0 then gcd(a, b) = gcd(b, a mod b).
  • Fermat’s Little Theorem: If p is 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.
  • H is universal hash function if for every two items x and y, exactly |H|/n of the functions map x and y to the same bucket (n = number of buckets).
  • Master Theorem: Given T (n) = aT ( nb ) + O(nd),

T (n) =

O(nd) if d > logb a O(nd^ log n) if d = logb a O(nlogb^ a) if d < logb a

  • FFT-recursive: A(ωj^ ) = Ae(ω^2 j^ ) + ωj^ Ao(ω^2 j^ ), ω = e^2 πi/n,
  • FFT-Matrix : Mn(ω)j,k = ωjk, for 0 ≤ j, k < n. Inverse: Mn(ω)−^1 = (^1) n Mn(ω−^1 ).