{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

quiz 3 review

# quiz 3 review - fails If it terminates will produce the...

This preview shows page 1. Sign up to view the full content.

4a. What A(x) says: if composite, don’t know what x is. If prime, must be prime. Case 1: x is composite: P(error | composite) == 0 Case 2: P(error | prime) = P(A(x) is wrong k times | + prime) P(A(x) is wrong | x prime) k <= (1 – 1/n) k = (1 – 1/n) n(k/n) = ((1-1/n) n ) k/n , set k = 100n. runtime = (1-1/n) n <= ½, 100n T(n) =O(nT n ) (1-1/n) k <= (1/2) 100 Alg1: P(some invocation of A(x) says composite | prime) >= P(first one says composite | prime) >= 1 – 1/n 4b. 1. 1 4c. O(1). O( If it says composite, you know it is composite. When it’s prime, it could be composite. C(x), if prime, then it is O(1/n) If B(x), if composite, then ½. P(don’t terminate in n steps) = P(an iteration fails) n <= (1-1/n) k Prob(terminate) = 0. Prob(terminate) = 1 if it returns the right answer. But when you don’t output anything, then it
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: fails. If it terminates, will produce the right answer .if it doesn’t produce an answer 4c. expectation = 1/prob = 1/(1/n) = n iterations. = n(T a (n) + T b (n)) Expection’ = 1/prob’ = 1/(1/2) = 2 -> 2 (T a (n) + T b (n)) B c mod (p – 1) O(#bits 3 ) Alg: compute x b c mod (p-1) time O(#bits 3 ) b === b’ (mod p – 1) X + k(p-1) = b c a kc mod p = a x+k(p-1) mod p = a x (a (p-1 ) k <= goes to one because of fermats theorem = 1 mod p, so a x mod p. 8. need to choose gcd(e, p-1). If e = p-1, then anything mod p = 1so all messages would be 1. Breaking this means recover M mod p = M. Compute d so hat ed = 1(mod(p-1)) ed – 1 = k(p-1) -> ed = 1+k(p-1) (M e mod(p-1)) d = (M e ) d mod p = (M e mod p) d = M 1 +k(p-1) mod p = M’(M p-1)k ) mod p = M’ mod p....
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online