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
- This is simply the remainder of 1000 on division by 13.
- 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.
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
- The infinite geometric series 1 + 1/2 + 1/4 + 1/8 + … has infinitely many positive terms and sums to exactly…
- Order the stages of the RSA idea.
- An ISBN-10 has digits d1 through d10 and must satisfy: 1 x d1 + 2 x d2 + ... + 10 x d10 is congruent to 0 mod…
- Sort each application by the number-theoretic idea it chiefly rests on.
- Complete the source of RSA's security.
- Select every idea from this unit that RSA depends on.
- Zeno argued you can never cross a room: first half the distance, then half the rest, forever. Why does the…