In hashmap terminology, what does 'collision' refer to?
When a hash function produces the same output for all inputs.
When two hashmaps have the same size.
When trying to delete a key that doesn't exist.
When two keys map to the same index in the hashmap.
What is a disadvantage of using a hashmap?
Cannot iterate over elements in a specific order.
Keys must be immutable.
Inability to handle collisions.
Slow search speed.
Which collision resolution technique is commonly used in hashmaps?
Merge Sort
Separate Chaining
Bubble Sort
Binary Search
A simple hash function for strings could involve summing the ASCII values of each character in the string. What is a potential drawback of this approach?
It's computationally expensive.
It can't handle strings of varying lengths.
It's not reversible, meaning you can't get the original string from the hash.
It can lead to a high number of collisions for anagrams.
Which of these is NOT a desirable property of a good hash function?
It should minimize collisions as much as possible.
It should be deterministic (same input always yields the same output).
It should distribute keys uniformly across the hash table.
It should be computationally expensive to calculate.
Which of these is a disadvantage of open addressing compared to separate chaining in hashmaps?
Cannot handle a large number of collisions efficiently.
Increased memory usage due to linked lists.
Requires more complex implementation compared to chaining.
Clustering of elements can lead to performance degradation.
Which of the following data structures is commonly used to implement a hashmap?
Linked List
Array
Tree
Graph
What happens when a hash function produces the same index for different keys?
The key-value pair is discarded.
A collision occurs.
The hash function is automatically updated.
The hashmap raises an error.
In hashmap collision resolution, what does separate chaining involve?
Using a secondary hash function to resolve collisions.
Storing colliding elements in a separate overflow area.
Creating linked lists at each index of the hash table to store colliding elements.
Finding the next available empty slot in the hash table.
Which characteristic of a hash function is undesirable and can lead to performance degradation?
Uniform Distribution
Fast Computation
Deterministic
High Collision Rate