A- Which of the following is/are true about hashing? Select allthat apply. A hash function typically maps
Question:
A- Which of the following is/are true about hashing? Select allthat apply.
A hash function typically maps a key to an index of anarray/table. | ||
Searching for an item in a collection of items can be achievedin constant time O(1) (or almost constant time) when hashing isused. | ||
In the worst case, searching for an item in a hash table with nitems takes O(log_2(n)) steps. | ||
Hashing usually inolves the use of an array/table. | ||
A good hash function ensures that multiple keys are mapped tothe same index/location. |
B-Which of the following is/are true about collision handlingstrategies? Select all that apply.
In linear probing, each slot in the table/array stores a keyvalue. | ||
In separate chaining, each slot in the table/array stores a keyvalue. | ||
In separate chaining, if three different keys hash to the sameindex, each key will be stored as a node of a linked list startingat that index. | ||
In separate chaining, if a key hashes into an index that isalready occupied, the value in that index will be overwritten bythe value of the key. | ||
In linear probing, if a key hashes into an index that is alreadyoccupied, the value in that index will be overwritten by the valueof the key |