1. Coins. (a) You have access to the program coinflip that returns 0 or 1, each
ID: 2969367 • Letter: 1
Question
1. Coins.
(a) You have access to the program coinflip that returns 0 or 1,
each with probability 0.5.
i. How would you write a program that uses coinflip and returns
a number in {0, 1, 2} with uniform probability?
ii. What is the probability that your program invokes coinflip
more than six times?
iii. What is the expected (mean) number of times that your program
invokes coinflip?
(b) You have access to the program unfair_coinflip that returns 0
with probability p or 1 with probability 1 ? p. You can assume
that 0 < p < 1. Without knowing p, how would you write a
program that uses unfair_coinflip and returns 0 or 1, each
with probability 0.5?
Explanation / Answer
please check this link it might help:
http://www.justanswer.com/computer-programming/6qifw-1-coins-work-casino-programmer-access.html
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.