{ "q1": { "type": "blank", "question": "\n

\n\nA hash table is a data structure where data is stored in an ____ manner.\nThis means that the data is ____ to array positions by a ____ function that\ngenerates a ____ value from each ____.\n\n

\n" }, "q2": { "type": "multiple", "question": "\n

Which of the following statements regarding hash functions are\ntrue (select all that apply?)

\n", "responses": { "normal_distribution": "The hash function should have a normal distribution.", "uniform_distribution": "The hash function should have a uniform distribution.", "deterministic": "The hash function should be deterministic.", "random": "The hash function should be random.", "fast": "The hash function should be fast.", "secure": "The hash function should be cryptographically secure." } }, "q3": { "type": "blank", "question": "\n

When the hash function maps two different keys to the same array\nposition, we call this a ____.

\n\n

One way to handle this situation is by using ____, where a new position\nis computed using a ____ sequence and the next record is stored in that\nposition.

\n\n

Another approach for handling this situation is using ____, where each\nlocation in the hash table is actually a ____ that can hold multiple\nvalues.

\n" }, "q4": { "type": "blank", "question": "\n

Complete the following implementation of a HashSet, which does\nnot handle collisions and simply uses modulus as the hash\nfunction:

\n\n
\n#define NBUCKETS (1<<8)\n\ntypedef struct {\n    int buckets[NBUCKETS];\n} HashSet;\n\nvoid    hashset_add(HashSet *s, int value) {\n    int bucket = ____ % ____;\n    ____ = value;\n}\n\nbool    hashset_contains(HashSet *s, int value) {\n    int bucket = ____ % ____;\n    return ____ == value;\n}\n
\n" } }