Ask Experts Questions for FREE Help !
Ask
    mah1's Avatar
    mah1 Posts: 3, Reputation: 1
    New Member
     
    #1

    May 31, 2012, 05:06 PM
    coin flip
    Coins. You work in a casino as a programmer. You have access to the
    following API:
    bool coinflip();
    It is simply a wrapper around a physical device that randomly produces
    0 or 1, each with probability 0.5.
    (a) The manager asks you to create a function
    int three_face_die();
    that produces a random number in {0; 1; 2} with uniform prob-
    ability. Of course you can use coinflip. How many calls to
    coinflip does your program make?
    (b) The physical device that coinflip uses just broke down. Now
    coinflip produces 0 with probability p and 1 with probability
    1 - p, but you don't know what p is. You can assume 0 < p < 1.
    Write a function
    bool fair_coinflip();
    that works like coinflip used to work. Your function has to be
    correct for all 0 < p < 1. Stated otherwise, how can you create
    a non-biased coin from a biased one as subroutine (and without
    knowing the bias p).

Check out some similar questions!

A 1-peso coin, a 10-centavo coin and a 25-centavo coin were tossed together [ 1 Answers ]

A 1-peso coin, a 10-centavo coin and a 25-centavo coin were tossed together with a die. How many possible outcomes could there be?

Flip a coin and toss a 1-6 number cube. Probability of: (4 and tails) [ 1 Answers ]

Flip a coin and toss a 1-6 number cube. Probability of: (4 and tails)

Nor gate flip flop [ 3 Answers ]

What are not gate flip flop and which book should I refer tooooo

A coin is tossed and a die is rolled. What is the probablity that the coin shows tail [ 1 Answers ]

A coin is tossed and a die is rolled. What is the probablity that the coin shows tails and the die shows a four?

Puck Flip [ 2 Answers ]

Ever see the pros flip the puck up and catch it for the ref? How do they do that? I can never get under it enough, I'd probably end up beaming the ref with the puck or something.


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.