Solving a probabilistic problem

Posted by ???????????? on Programmers See other posts from Programmers or by ????????????
Published on 2014-08-24T18:27:06Z Indexed on 2014/08/24 22:32 UTC
Read the original article Hit count: 249

Filed under:

So I am interested in Computational Investing and came across this problem on a wiki page:

Write a program to discover the answer to this puzzle:"Let's say men and women are paid equally (from the same uniform distribution). If women date randomly and marry the first man with a higher salary, what fraction of the population will get married?"

I don't have much knowledge in probability theory, so I'm not really sure how to implement this in code.

My thinking:

  1. Populate two arrays(female,male) with random salary values from a uniform distribution.
  2. Randomly pair one female and one male array element and see if condition of higher salary is met.
  3. If it is, increment a counter.
  4. Divide counter by population and get percentage.

Is this the correct logic? Do woman continually date until there is no males left with higher salaries than women?

© Programmers or respective owner

Related posts about problem-solving