# MIT 6 856J - Randomized Algorithms (6 pages)

Previewing pages 1, 2 of 6 page document
View Full Document

# Randomized Algorithms

Previewing pages 1, 2 of actual document.

View Full Document
View Full Document

## Randomized Algorithms

21 views

Problems/Exams

Pages:
6
School:
Massachusetts Institute of Technology
Course:
6 856j - Randomized Algorithms
##### Randomized Algorithms Documents
• 6 pages

• 3 pages

• 6 pages

• 2 pages

• 7 pages

• 2 pages

• 4 pages

• 7 pages

• 2 pages

• 5 pages

• 2 pages

• 3 pages

• 5 pages

• 2 pages

• 7 pages

• 4 pages

• 2 pages

Unformatted text preview:

6 856 Randomized Algorithms David Karger Handout 4 September 17 2002 Homework 1 Solutions M R refers to this text Motwani Rajeez and Prabhakar Raghavan Randomized Algorithms Cambridge Cambridge University Press 1995 Problem 1 MR 1 1 a We rely on the fact that ips are independent even if biased To try to generate one bit ip the coin twice If you get heads followed by tails HT then output heads If tails followed by heads TH output tails If HH or TT report failure Conditioned on having succeeded gotten HT or TH the probability that you got HT is equal to the probability you got TH so the output you produce is unbiased If you fail you try again repeating until you succeed The probability that you succeed in one trial is just 2p 1 p probability of one head and one tail So the number of trials you perform before succeeding has a geometric distribution its expectation is 1 2p 1 p Since we toss the coin twice at each trial the expected number of total coin tosses is 1 p 1 p b The following solution owes to Elias72 This one is tricky Any reasonable e ort is su cient for full credit Before we tackle the problem itself let us consider the following scenario suppose you are given a number r drawn uniformly at random from 1 N How many unbiased bits can you output from such a sample The following scheme will turn out to be asymptotically optimal Suppose that the binary representation of N is as follows N m 2m m 1 2m 1 1 21 0 20 where i 0 1 m 1 and m log N We assign output strings to the N numbers so that for every i 0 with i 1 we map 2i of the numbers to all the binary strings of length i The exact assignment does not matter but since every input number is equally likely we are assured that the output bits are unbiased and independent random bits Note that if N is odd i e 0 1 one of the input numbers will not be assigned to any output if we encounter it we output nothing Luckily this case will become increasingly unlikely as N grows It remains to be seen how many bits we expect

View Full Document

Unlocking...