What is the primary advantage of using a universal hash function?
It provides better performance than any single, fixed hash function.
It eliminates the possibility of collisions entirely.
It ensures constant-time performance for all operations.
It makes the hash table resistant to attacks that exploit patterns in the hash function.
Which of the following is NOT a valid mitigation strategy against hash flooding attacks?
Switching to a different data structure like a tree-based map that offers consistent performance.
Using a fixed-size hashmap to limit the maximum number of collisions.
Implementing a random salt value in the hash function to make collisions unpredictable.
Employing a bloom filter to quickly identify and discard potentially malicious input.
What is the primary reason for using a prime number as the size of a hash table in many implementations?
To make the implementation of the hash table simpler.
To ensure an even distribution of keys across the hash table, reducing collisions.
To minimize the memory usage of the hash table.
To increase the speed of hash function computation.
Hopscotch hashing aims to improve the performance of open addressing by:
Using multiple hash tables to store keys with different hash values.
Limiting the maximum distance a key can be placed from its original hash index.
Using a dynamic array to resize the table when the load factor gets high.
Employing a binary search tree for efficient collision resolution.
You are designing a system to store and retrieve frequently accessed data with high performance. Which of the following hash table collision resolution strategies would generally offer the BEST performance under high load factors?
Quadratic Probing
Double Hashing
Linear Probing
Separate Chaining
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 eliminates the need for collision handling.
It reduces the memory used by the hash table.
How does using a cryptographic hash function with a random salt improve the security of a hashmap storing user credentials?
It makes it significantly harder for attackers to perform rainbow table attacks.
It encrypts the data stored in the hashmap, making it unreadable without the decryption key.
It prevents unauthorized users from accessing the hashmap's keys.
It eliminates the possibility of hash collisions.
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?
Queue
Linked list
Array
Tree
In the context of amortized analysis of hash table operations, what does the term "amortized" refer to?
The average time complexity of an operation over a sequence of operations.
The time complexity of an operation when the hash table is full.
The worst-case time complexity of an operation.
The best-case time complexity of an operation.
In a hash table using double hashing, the second hash function is used to:
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.
Determine the initial index to store the key.