In a hashmap implementation using open addressing with linear probing, what is the worst-case time complexity for searching for a key if the hash table is nearly full?
O(log n)
O(1)
O(n log n)
O(n)
How can a hash flooding attack impact the performance of a web server using a hashmap to store session data?
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.
It can cause a denial-of-service by forcing the server to handle a large number of collisions.
What is the primary reason for using a prime number as the size of a hash table in many implementations?
To increase the speed of hash function computation.
To ensure an even distribution of keys across the hash table, reducing collisions.
To minimize the memory usage of the hash table.
To make the implementation of the hash table simpler.
In a hash table with open addressing using linear probing, suppose we perform a sequence of insertions where each key hashes to the same index. What is the time complexity of the nth insertion in the worst case?
What is a common disadvantage of using a hashmap with a poorly chosen hash function?
Inability to handle duplicate keys
Frequent hash collisions
Increased memory usage
Slow key generation
How does using a cryptographic hash function with a random salt improve the security of a hashmap storing user credentials?
It prevents unauthorized users from accessing the hashmap's keys.
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 eliminates the possibility of hash collisions.
In a hash table using double hashing, the second hash function is used to:
Calculate the size of the hash table.
Determine the step size for probing in case of a collision.
Determine the initial index to store the key.
Generate a new key if a collision occurs.
In cuckoo hashing, how many hash functions are typically used?
2
1
3
It depends on the size of the hash table.
What mechanism does Java's ConcurrentHashMap employ to allow for concurrent reads and updates while maintaining thread safety?
Read-write locks separating readers and writers
A single global lock for all operations
Lock-free data structures using atomic operations
Fine-grained locking at the bucket level
In the context of hash tables, what does a high load factor indicate?
A higher probability of collisions.
Lower memory usage.
A more efficient hash function is being used.
Faster insertion operations.