Question: In a country where everyone wants a boy, each family continues having babies till they have a boy. After some time, what is the proportion of boys to girls in the country? (Assuming probability of having a boy or a girl is the same)
Answer: This is a very simple probability question in a software interview. This question might be a little old to be ever asked again but it is a good warm up.
Assume there are C number of couples so there would be C boys. The number of girls can be calculated by the following method.
Number of girls = 0*(Probability of 0 girls) + 1*(Probability of 1 girl) + 2*(Probability of 2 girls) + …
Number of girls = 0*(C*1/2) + 1*(C*1/2*1/2) + 2*(C*1/2*1/2*1/2) + …
Number of girls = 0 + C/4 + 2*C/8 + 3*C/16 + …
Number of girls = C
(using mathematical formulas; it becomes apparent if you just sum up the first 4-5 terms)
The proportion of boys to girls is 1 : 1.
Sunday, May 2, 2010
Subscribe to:
Post Comments (Atom)
Wonderful article. thanks for putting this together! This is obviously one great post. Thanks for the valuable information and insights you have so provided here.
ReplyDelete訂婚戒指
I wanted to thank you for this great read!! I definitely enjoying every little bit of it I have you bookmarked to check out new stuff you post.
ReplyDeleterestoration company fort wayne
This is a great post. I like this topic.This site has lots of advantage.I found many interesting things from this site. It helps me in many ways.Thanks for posting this again.
ReplyDeleteshed roof construction types
Thanks for posting this info. I just want to let you know that I just check out your site and I find it very interesting and informative. I can't wait to read lots of your posts.
ReplyDeleteflooded basement cleanup
The website is looking bit flashy and it catches the visitors eyes. Design is pretty simple and a good user friendly interface.
ReplyDeletehttps://www.lawsofcolor.com/
This is highly informatics. crisp and clear. I think that everything has been described in systematic manner so that reader could get maximum information and learn many things.
ReplyDeletephotoshop drawing
Thank you for taking the time to publish this information very useful!
ReplyDeletedigital drawing tutorial