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: 348
        
problem-solving
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:
- Populate two arrays(female,male) with random salary values from a uniform distribution.
- Randomly pair one female and one male array element and see if condition of higher salary is met.
- If it is, increment a counter.
- 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