Describe a procedure that takes as input two integers a and b such that 0 < a
Question:
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.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Related Book For
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
Question Posted: