COS 554 SPRING 2009 HW #6 DUE TUESDAY 3/17/09 p. 229: 11.2-2, 10 points p. 229: 11.2-5, 10 points p. 236: 11.3-3, 15 points p. 236: 11.3-4, 10 points p. 244: 11.4-1, 20 point p.1105: C.2-2, 10 points See Problem 1 below, 25 points ********** Problem Notes *********, Solve problems 11.2-2, 11.3-3, 11.3-4, 11.4-1 and Problem 1 below by writing programs. These programs should use the data in the problem and produce the expected results. They should be easy to read and should include comments. You can add comments to Logo programs using ";". Unless explicit language requirements are stated, you may use either of the five languages C, Pascal, LISP, Python or Logo in this course. For many short problems, Python will be the fastest language for coding. As noted in the syllabus, I expect programs to come with printed source code and printed sample output. The source code should be comprehensible and contain comments. For problems C.2-2 and C.2-10 you must start with a sample space and then put a probability distribution on it. If I don't see a reasonable sample space for the problem, you will get 0 points for the solution regardless of how good it is. PROBLEM 1. Write a program that will do the following: (a) Find a 12 digit number, p, that you can verify is prime. (b) Pick a subset S, consisting of 100 integers at random from 0 to p-1 (explain how you are sure that you are picking using the uniform distribution). (c) Let m be 200. Pick 50 random functions of the type described in Theorem 11.5 on page 235 of the book and look at the average number of collisions for each of these hash functions. In other words, if h:S -> {0,...,m-1} is a hash function, let Col(h) = the number of pairs (x,y), with x and y in S, x <>y, and h(x) = h(y). I expect you count (x,y) and (y,x) as separate pairs, even though they really are the same pair. Once you have the values for each of the 50 functions, you can then average these values. (d) Explain how well the result in (c) above compares with the theoretical results.