html5-img
1 / 3

Birthday Problem

For a description of the birthday problem (or paradox) see the Wikipedia article:. Birthday Problem. http://en.wikipedia.org/wiki/Birthday_problem.

nanji
Download Presentation

Birthday Problem

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. For a description of the birthday problem (or paradox) see the Wikipedia article: Birthday Problem http://en.wikipedia.org/wiki/Birthday_problem

  2. Write a program that tests the result of the birthday problem. First write a boolean function, sameBirthday, that takes an integer n (the number of people in the group). The function randomly assigns birthdays to that number of people, and then checks if two or more people have the same birthday, and returns true if they do, and returns false if not. Exercise

  3. The main function should loop through n, from 2 to 50, and for each n, run 5,000 trials of the birthday problem. For each n, print out the number of times that 2 or more people had the same birthday, and the probability that 2 or more people had the same birthday (the number of times divided by 5,000). You may assume a non-leap year (365 days). Exercise (cont'd)

More Related