In the context of hashmaps, what does 'probing' refer to?
Searching for a specific key in the hashmap.
Determining the load factor of 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 hash table using separate chaining for collision resolution, what is the worst-case time complexity for searching for an element?
O(log n)
O(n)
O(n log n)
O(1)
In a system where memory usage is a major concern, what trade-off should be considered when using a hashmap?
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.
Collision resolution strategies have no impact on memory consumption.
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.
The hash function has a negligible impact on performance compared to the data structure itself.
A complex hash function guarantees a lower collision rate, improving performance.
What is a significant disadvantage of using a fixed-size hash table in conjunction with a hash function prone to collisions?
Inability to store data that exceeds the pre-defined table size
Complexity in implementing the hash function itself
Increased memory usage due to the fixed size allocation
Degraded performance due to chaining or open addressing for collision resolution
When does rehashing typically occur in a hashmap?
When the load factor exceeds a predetermined threshold.
When the hashmap is cleared using the clear() method.
When the hash function is modified.
Every time a new key is inserted.
What is a primary disadvantage of using linear probing for collision resolution in a hash table?
Complex implementation
Not suitable for open addressing
Higher memory overhead compared to chaining
Increased potential for primary clustering
In a web server, which scenario is best suited for using a hashmap to optimize performance?
Managing the order of user connections to ensure fairness
Storing and retrieving user session data
Maintaining a log of all incoming requests in chronological order
Storing and retrieving static website content like images and CSS files
Which collision resolution technique involves using a second, independent hash function to compute the probe sequence?
Separate Chaining
Double Hashing
Quadratic Probing
Linear Probing