Thread: Something about probablility

  1. #16
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    If you're the contestant, should you switch doors? Should you stay on your door? Does it matter?
    I will switch to the opened door. Each of those golden donkeys are worth $200,000.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  2. #17
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    I will switch doors. After one of the wrong doors has been removed from play, the chance that I get the right door by switching equals the chance of hitting a wrong door on the first try, i.e. 66%.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #18
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    It really doesn't matter. MY chance of hitting the right door is 1:2 whether I switch or not.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  4. #19
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    It really doesn't matter. MY chance of hitting the right door is 1:2 whether I switch or not.
    So you disagree with CornedBee's reasoning? Remember, the host responds to what you originally chose.

    Incidentally, I'll probably have to keep to my chosen door since the fellow does not allow me to grab the donkey he revealed
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  5. #20
    Dr Dipshi++ mike_g's Avatar
    Join Date
    Oct 2006
    Location
    On me hyperplane
    Posts
    1,218
    I'd go berserk rip the doors out, grab the money, mount a donkey and charge off.

  6. #21
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    Quote Originally Posted by laserlight View Post
    So you disagree with CornedBee's reasoning? Remember, the host responds to what you originally chose.
    CornedBee reasoning is interesting, but falls to the same trap we have been discussing. What generates the probability event is that last instant when I'm given the choice of switching or not.

    Since one door has a donkey and another the money, odds are 1:2

    EDI: As for the host, no matter what door I choose initially, the host can always open a door with a donkey in it.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  7. #22
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    The discussion/reasoning is an important part of the interview question.

    Let's hear what others have to say before we settle it.

  8. #23
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    The discussion/reasoning is an important part of the interview question.
    That's what I thought, since this problem has been circulating for years. Just blurting out a "model answer" should not be good enough.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  9. #24
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    For the people who have heard it, I ask them to explain the answer to me. The ones who have not often get it wrong, so I listen to their reasoning and also pay attention to how well it seems they understand the answer when I explain it.

    It's actually better if they've heard it before, because I really get a feel for how well they can express and explain something (which is very important when coding in teams). It's harder to tell if they really understand you when you explain it to them.

  10. #25
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    I haven't heard it before and just to be safe I went back and checked for the possibility of it being a trick question

    It doesn't seem so. I stand by my answer.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  11. #26
    Dr Dipshi++ mike_g's Avatar
    Join Date
    Oct 2006
    Location
    On me hyperplane
    Posts
    1,218
    Yeah, I'm with Mario on this. My reasoning would be exactly the same.

  12. #27
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    I'd keep my choice, but I wouldn't tell the host. That way, I'd always be right.

    Heisenberg's cat theory is stupid.

  13. #28
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    I haven't heard it before and just to be safe I went back and checked for the possibility of it being a trick question
    I do not think it is a trick question when phrased this way, though on a game show it probably would be a trick question (which is why I would never want to be a game show contestant... I will probably freak out on stage when presented with trick questions).

    My reasoning would be based on counting:

    Let A be the winning door.

    Suppose you pick door A. If you switch, you lose.
    Suppose you pick door B. If you switch, you win.
    Suppose you pick door C. If you switch, you win.

    Since you pick the door at random and switching wins 2/3 of the time, you should switch to win. Although the host has the choice of opening either B or C if you pick A, his choice does not matter since you already played your move (pick A then switch).

    The reason this happens is that the host responds to your choice by eliminating a losing door ("after one of the wrong doors has been removed from play"), so it is a matter of counting the number of wins versus losses when a switch is made after each of the original three choices.

    If the host eliminates a door at random (e.g., instead of opening the door, he claims that the closed door he selected is a poor choice, but he does not know what is behind the door), then indeed it would make no difference.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  14. #29
    Dr Dipshi++ mike_g's Avatar
    Join Date
    Oct 2006
    Location
    On me hyperplane
    Posts
    1,218
    Actually that makes sense now as the host would not open the winning door as that would not make good tv. So by switching you would be moving from 1/3 to 2/3 chance of winning. So yeah I get it now

  15. #30
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    I hate statistics, but I love probability.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed