What is the purpose of dynamic resizing (rehashing) in a hashmap?
To improve the efficiency of key deletion operations.
To increase the size of the hash function's output range.
To reduce the number of keys stored in the hashmap.
To maintain a low load factor and prevent performance degradation.
What advantage does separate chaining have over open addressing techniques in hash table collision resolution?
Faster search times at high load factors
Handles load factors greater than 1 gracefully
Simpler implementation
Lower memory overhead
How does universal hashing enhance the robustness of hash tables?
By eliminating the possibility of hash collisions entirely
By minimizing the impact of hash collisions on retrieval time
By ensuring a uniform distribution of keys across the hash table
By dynamically adjusting the hash function to the input data
Which collision resolution technique involves using a second, independent hash function to compute the probe sequence?
Separate Chaining
Quadratic Probing
Linear Probing
Double Hashing
When choosing a collision resolution strategy for a hash table, which factors are essential to consider?
Programming language and hardware architecture
All of the above
Expected data distribution and load factor
Size of the keys and values being stored
You need to identify the first non-repeating character in a string. How can a hashmap be utilized to solve this problem efficiently?
A hashmap cannot be used efficiently for this problem.
Store the frequency of each character in the hashmap, then iterate through the string and return the first character with a frequency of 1.
Store the characters of the string as keys in the hashmap, and their positions as values. The first character with the lowest position value is the first non-repeating character.
Use the hashmap to store the unique characters of the string, then iterate through the hashmap to find the first non-repeating character.
In the context of hashmaps, what does 'probing' refer to?
Determining the load factor of the hashmap.
Searching for a specific key in the hashmap.
Finding an alternative slot for a key when a collision occurs.
Resizing the underlying array to accommodate more keys.
You are implementing an LRU (Least Recently Used) cache. Which data structure, in conjunction with a hashmap, is most suitable for tracking the usage order of cached items?
Doubly Linked List
Binary Tree
Queue
Stack
In a system where memory usage is a major concern, what trade-off should be considered when using a hashmap?
Collision resolution strategies have no impact on memory consumption.
A larger hash table size generally results in faster lookups but consumes more memory.
Hashmaps always use less memory than arrays for storing the same data.
Using a complex hash function always reduces collisions and memory usage.
How does quadratic probing aim to mitigate the clustering problem in open addressing?
By probing with exponentially increasing intervals
By probing with quadratically increasing intervals
By using a second hash function to determine the probe sequence
By probing linearly with a fixed step size