In the context of hash tables, what does a high load factor indicate?
A higher probability of collisions.
Faster insertion operations.
A more efficient hash function is being used.
Lower memory usage.
Why is it generally recommended to avoid using mutable objects as keys in hash tables?
Hash tables cannot store mutable objects as keys; only immutable objects are allowed.
Mutable keys can lead to inconsistent state if their values are modified after being inserted into the hash table.
Using mutable keys increases the memory overhead of the hash table.
Mutable keys make the implementation of the hash table significantly more complex.
In the context of amortized analysis of hash table operations, what does the term "amortized" refer to?
The time complexity of an operation when the hash table is full.
The best-case time complexity of an operation.
The average time complexity of an operation over a sequence of operations.
The worst-case time complexity of an operation.
What is a common disadvantage of using a hashmap with a poorly chosen hash function?
Increased memory usage
Slow key generation
Frequent hash collisions
Inability to handle duplicate keys
How can a hash flooding attack impact the performance of a web server using a hashmap to store session data?
It can cause a denial-of-service by forcing the server to handle a large number of collisions.
It has no impact on performance, as hash flooding attacks only target data integrity.
It can lead to increased memory usage and faster response times.
It can improve the efficiency of the hashmap by distributing data more evenly.
Which of these data structures can provide a more secure and performant alternative to a hashmap when handling user authentication data, especially in scenarios prone to hash flooding attacks?
Array
Linked list
Queue
Tree
Which of these statements best describes the advantage of using a perfect hash function over a regular hash function?
It guarantees constant-time search, insertion, and deletion in the worst case.
It allows for faster key insertions.
It reduces the memory used by the hash table.
It eliminates the need for collision handling.
Hopscotch hashing aims to improve the performance of open addressing by:
Using multiple hash tables to store keys with different hash values.
Using a dynamic array to resize the table when the load factor gets high.
Limiting the maximum distance a key can be placed from its original hash index.
Employing a binary search tree for efficient collision resolution.
Which of the following is NOT a valid mitigation strategy against hash flooding attacks?
Implementing a random salt value in the hash function to make collisions unpredictable.
Using a fixed-size hashmap to limit the maximum number of collisions.
Switching to a different data structure like a tree-based map that offers consistent performance.
Employing a bloom filter to quickly identify and discard potentially malicious input.
In a hash table using double hashing, the second hash function is used to:
Determine the initial index to store the key.
Determine the step size for probing in case of a collision.
Calculate the size of the hash table.
Generate a new key if a collision occurs.