Test 1

1. Chip Test problem (200 Points)

Write in an Ipython notebook in Google Colaboratory [https://colab.research.google.com/] the algorithm that solves the for the Chip Test problem in liner time when the number of good chips |G| is larger that than the number of bad chips|B|, |G| > |B|; the program receives n the total number of chips, m = the number of good chips |G| and r the number of simulation runs and plots:

  • the distribution of the number of the chips in the first global iteration,
  • the distribution of the number comparisons in total until the algorithm stops,
  • display the maximum, minimum, average in each case

Assume if the number of chips is odd the chip to be tested is chosen uniformly at random, the chips are paired uniformly at random and the bad chips answer G or B about the other chip with probability 1/2. ( test first global iteration n=10, m= 6 ->[1,5], m=7->[[2,4], m=->8 [3,5], m=9 -> [4], m=10->[5])

3. Moodle test (300 points)