Google interview questions, the proportion of male and female students?

Source: Internet
Author: User

Google Interview questions:

In a country with a preference for boys, every family wants to have a boy, and if the child is a girl, regenerate one, until the boy is born, so the proportion of men and women in such a country will be much.


Answer: 1:1

Analysis:
The probability of birth is 50%, so the sex ratio is the same for each birth.


Topic of Ali:

A country is very patriarchal, if a family gave birth to a girl, then another, until the birth of a boy, assuming that the probability of male and female students equal, I would like to ask the average number of girls per family.


And Google's problem is actually the same.


If there are n couples in this country, then n couples will give birth to n boys, these n boys are born in this way, assuming that the probability of the birth of a boy is 50%, then n/2 a boy is the first child, and there will be n/2 a girl born, n/2 couples will continue to live, of which n/4 couples born boys, n /4 of couples continue to give birth to girls, then N/8 couples get boys, and n/8 couples give birth to girls, and so on, this country will give birth to N/2 + N/4 + N/8 + ... Girls, so the ratio of male to female is N: (n/2 + N/4 + n/8 + ...) = N:n = 1:1

The process is the same, the probability of birth of both boys and girls is 50%, so the ratio of each birth is the same.


Original address: http://www.java2000.net/p11054






Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.