A storage component uses range reduction, the conversion of an integer hash code into a valid array index. Its eight permitted indices are 0 through 7. For a hash code ccc, it calculates
The floor function is denoted by ⌊ ⌋\lfloor\ \rfloor⌊ ⌋. Complete the table with the floor value and resulting index for each supplied hash code. Enter exact integers.
Unlock full course notes by signing up
Comparing two ways to combine letters
A catalogue assigns the letter values A = 1, D = 4, and H = 8. For each two-letter key, let xxx be the first letter's value and yyy the second letter's value. Compare these hash functions:
Modulo returns the nonnegative remainder. Complete every index cell with an exact integer from 0 through 6. The indices have no units.
Does transforming a hash improve its distribution?
A catalogue computes an exact nonnegative integer code C(k)C(k)C(k) for each key kkk. A developer proposes replacing
with
Collision counts and collision probability
A test selects a hash function at random for seven fixed, distinct identifiers. Across the possible selected functions, each identifier's hash code is equally likely to be any integer from 0 through 19, and the seven codes are independent. Once selected, the function remains fixed for later evaluations.
A collision occurs when distinct identifiers receive the same hash code. Calculate both quantities below for the initial random selection:
The expected number of colliding unordered pairs, to two decimal places.