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 xx be the first letter's value and yy the second letter's value. Compare these hash functions:


f(x,y)=(x+y) mod 7,g(x,y)=(5x+y) mod 7.f(x,y)=(x+y)\bmod7, \qquad g(x,y)=(5x+y)\bmod7.


Modulo returns the nonnegative remainder. Complete every index cell with an exact integer from 0 through 6. The indices have no units.

Keyf indexg index
AD
DA
AH
HA

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Hash Codes and Hash Functions Questions: