What is the purpose of dynamic resizing (rehashing) in a hashmap?
To reduce the number of keys stored in the hashmap.
To maintain a low load factor and prevent performance degradation.
To improve the efficiency of key deletion operations.
To increase the size of the hash function's output range.
You need to count the frequency of each word in a large text document. Which combination of data structures would be most efficient for this task?
A sorted linked list where each node contains a word and its frequency
A hashmap where words are keys and their frequencies are values
A binary tree where words are stored in the nodes and their frequencies are stored in the leaves
Two arrays: one for storing words and one for storing their frequencies
How does the choice of a hash function impact the performance of a hashmap?
A simple hash function is always preferred as it reduces computational overhead.
A well-chosen hash function minimizes collisions, leading to faster lookups and insertions.
A complex hash function guarantees a lower collision rate, improving performance.
The hash function has a negligible impact on performance compared to the data structure itself.
In the worst-case scenario, what is the time complexity of searching for a key in a hashmap?
O(n log n)
O(n)
O(1)
O(log n)
In a hash table using separate chaining for collision resolution, what is the worst-case time complexity for searching for an element?
In the context of hash functions, what does the avalanche effect refer to?
A small change in input causing a significant change in output
Increased likelihood of hash collisions with larger datasets
Gradual degradation of hash performance over time
Uneven distribution of keys within the hash table
When choosing a collision resolution strategy for a hash table, which factors are essential to consider?
All of the above
Programming language and hardware architecture
Expected data distribution and load factor
Size of the keys and values being stored
When does rehashing typically occur in a hashmap?
When the hashmap is cleared using the clear() method.
Every time a new key is inserted.
When the hash function is modified.
When the load factor exceeds a predetermined threshold.
What is the significance of the output size of a cryptographic hash function?
Affects the uniqueness of the hash for different inputs
Impacts the resistance against brute-force attacks
Influences the memory required to store the hash function
Determines the speed of hash computation
In the context of hashmaps, what does 'probing' refer to?
Finding an alternative slot for a key when a collision occurs.
Determining the load factor of the hashmap.
Resizing the underlying array to accommodate more keys.
Searching for a specific key in the hashmap.