Exercises
The following exercises provide you with the opportunity to practice with hash functions, randomized hashing, and hash function families. The solutions to these exercises are found in the section Chapter 10.
-
Imagine that you’re the nefarious hacker I described in the chapter. You’ve found an app to exploit, and you obtained its source code. (Bwah hah hah hah!) When reading the code, you discover that it stores its data in a hash table, and the hash function being used is the Division Method. However, it’s not randomizing the hash function in any way. Instead, the app always uses the following hash function, with K representing the key being hashed:
K % 997 What data can you feed the app so that all the data ends up in the same slot ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access