This preview shows page 1. Sign up to view the full content.
Unformatted text preview: (Hi−1 ) for i ≥ 1.
For the purpose of this homework, each student’s hash function is the last k bits of SHA1 seeded
with his or her CSELabs username. In other words, h|k (x) = SHA1(userid||x) mod 2k . After
reading Section 2.1.6 of HAC (available from http://www.cacr.math.uwaterloo.ca/hac/about/
chap2.pdf), answer the following questions.
(a) [10 points] Write a computer program to compute the number of components, average/max
tail length, and min/average/max cycle length in your h|16 . Your output should print out
these 6 numbers. Tail and cycle are deﬁned in 2.35. To avoid the confusion, tail length is
deﬁned as the number edges of the path to a cycle from a point. In the following Figure, the
number of components is 2, tail length of node 13 is 3, tail length of node 12 is 1, and the
tail length of 6 is 0. The Average tail length is (3+2+1+1)/4 = 1.75. (i.e. average length of
tails starting from the terminal points with no preimage.) The cycle length of [1, 4, 6, 9] is 4.
Your main submission should brieﬂy describe how your program works and how to compile
View Full Document
- Spring '14