Question: Describe a procedure that takes as input two integers a and b such that 0 < a < b and, using fair coin flips, produces

Describe a procedure that takes as input two integers a and b such that 0 < a < b and, using fair coin flips, produces as output heads with probability a/b and tails with probability (b – a)/b. Give a bound on the expected number of coin flips, which should be O(1). Represent a/b in binary.

Step by Step Solution

3.42 Rating (155 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

This is actually tricky You represent abab as binary Then you start flipping ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Introduction to Algorithms Questions!