What is the time complexity, in the average case, for searching for a key in a well-implemented hashmap?
O(log n)
O(n log n)
O(n)
O(1)
Which characteristic of a hash function is undesirable and can lead to performance degradation?
Uniform Distribution
Fast Computation
High Collision Rate
Deterministic
Which of the following is NOT a collision handling technique in hashmaps?
Binary Search
Separate Chaining
Open Addressing
Linear Probing
What is the primary role of the modulo operator (%) in simple hash functions?
To sort keys in ascending order based on their hash values.
To map the hash code to a valid index within the array's bounds.
To generate a unique hash code for each key.
To handle collisions effectively.
What is the primary advantage of using a hashmap over a linear search in an array when searching for a specific value?
Hashmaps offer faster search times on average.
Hashmaps can handle duplicate values more efficiently.
Hashmaps use less memory.
Hashmaps can store sorted data.
Which of the following operations typically has a time complexity of O(n) in the worst case for a hashmap?
Insertion
Deletion
All of the above
Search
Which collision resolution technique is commonly used in hashmaps?
Bubble Sort
Merge Sort
In hashmap terminology, what does 'collision' refer to?
When two hashmaps have the same size.
When trying to delete a key that doesn't exist.
When a hash function produces the same output for all inputs.
When two keys map to the same index in the hashmap.
Why is a good hash function important for hashmap performance?
To allow for efficient resizing of the hash table.
To ensure that keys are evenly distributed across the hash table, reducing collisions.
To reduce the memory used by the hash table.
To minimize the number of comparisons required to find an element.
What is a significant disadvantage of using a hashmap when you need to retrieve elements in a sorted order?
Hashmaps have slow insertion times.
Hashmaps have high memory consumption.
Hashmaps don't inherently maintain order.
Hashmaps cannot handle duplicate values.