Mathematics I / Number Theory in Action
Practice question · Numerical answer

A hash table has 13 slots and uses the hash function 'key mod 13'. Which slot does the key 1000 land in?

Hints
  1. This is simply the remainder of 1000 on division by 13.
  2. 13 x 76 = 988.
Show the answer

12

Why

1000 = 13(76) + 12, so the key lands in slot 12. Hash tables are pure 'reduce mod n': the table size is often chosen PRIME so that keys sharing a common factor with the size do not pile into the same few slots.

Read the lesson: Number Theory in Action →

Practise Number Theory in Action

The app has 5 more questions on this lesson, and keeps your place in the course. Mathematics I is free to start.

More questions on Number Theory in Action