Which of these is NOT a desirable property of a good hash function?
It should be deterministic (same input always yields the same output).
It should be computationally expensive to calculate.
It should minimize collisions as much as possible.
It should distribute keys uniformly across the hash table.
What is a key advantage of using a hashmap over a sorted array for searching?
Hashmaps maintain data in sorted order.
Hashmaps offer faster search on average.
Hashmaps consume less memory.
Hashmaps allow duplicate keys.
If you were designing a simple hash function for strings, which operation would likely be a core component?
Converting characters to their ASCII codes and performing arithmetic operations.
Reversing the string.
Sorting the characters in the string alphabetically.
Finding the length of the string.
Which of the following operations typically has a time complexity of O(n) in the worst case for a hashmap?
Search
Insertion
All of the above
Deletion
Why are hash functions typically designed to be fast to compute?
To prevent data loss during collisions.
To maintain the sorted order of keys.
To minimize memory usage.
To ensure efficient insertion, deletion, and search operations.
What is the primary role of the modulo operator (%) in simple hash functions?
To map the hash code to a valid index within the array's bounds.
To handle collisions effectively.
To generate a unique hash code for each key.
To sort keys in ascending order based on their hash values.
Which characteristic of a hash function is undesirable and can lead to performance degradation?
High Collision Rate
Uniform Distribution
Fast Computation
Deterministic
In hashmap collision resolution, what does separate chaining involve?
Storing colliding elements in a separate overflow area.
Using a secondary hash function to resolve collisions.
Finding the next available empty slot in the hash table.
Creating linked lists at each index of the hash table to store colliding elements.
What is the purpose of a load factor in a hashmap?
To store the maximum number of key-value pairs.
To determine when to resize the hashmap.
To count the number of collisions.
To measure the efficiency of the hash function.
Which of the following is NOT a collision handling technique in hashmaps?
Linear Probing
Separate Chaining
Binary Search
Open Addressing