A catalogue computes an exact nonnegative integer code C(k)C(k)C(k) for each key kkk. A developer proposes replacing
with
Both functions return indices from 0 through 11, and arithmetic has no overflow. Which statements hold for every possible collection of keys? Select all that apply.
The number of colliding key pairs can decrease when hhh is replaced by ggg.
Every pair of keys that collides under ggg also collides under hhh.
Each occupied index under hhh maps to a distinct occupied index under ggg.
Unequal index probabilities under hhh become equal index probabilities under ggg.
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.
Reducing signed hash codes to array indices
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.
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.