MCQs
Since each key is associated with a slot in the array, it is better to use direct addressing when the universe of keys is small as the array size grows with the increase in number of keys.
Using a dynamic set, the size of the array is restricted to the number of keys, hence saves space.
As every key has a unique array position, it takes constant time to insert an element.
Since every key has a unique array position, searching takes a constant time.
As every key has a unique array position, it takes constant time to delete an element, although the deleted position must be specified by nil.
Direct addressing is possible only when we can afford to allocate an array that has one position for every possible key.
Making the hash function random is not really a good choice, although it is considered one of the techniques to avoid collisions along with chaining and simple uniform hashing.
Since every key has a unique array position, searching takes a constant time
In a hash table, there are fewer array positions than the keys, so the position of the key in the array has to be computed, this is done using the hash function.