In the context of hash tables, what does a high load factor indicate?
Faster insertion operations.
A higher probability of collisions.
Lower memory usage.
A more efficient hash function is being used.
Python dictionaries use open addressing for collision resolution. Which of the following techniques helps mitigate the performance degradation caused by clustering in open addressing?
Linear Probing with a prime step size
Robin Hood Hashing
Using a cryptographic hash function
Separate Chaining
You are implementing an LRU (Least Recently Used) cache with a fixed capacity. Which data structure combination would be most suitable for efficiently managing the cache?
Binary Search Tree + Heap
Hashmap + Doubly Linked List
Hashmap + Stack
Array + Queue
What mechanism does Java's ConcurrentHashMap employ to allow for concurrent reads and updates while maintaining thread safety?
Fine-grained locking at the bucket level
Read-write locks separating readers and writers
Lock-free data structures using atomic operations
A single global lock for all operations
Which collision resolution strategy generally performs better in terms of cache locality?
Cache locality is irrelevant to hash tables
Both perform equally well
Open Addressing
What is the primary reason for using a prime number as the size of a hash table in many implementations?
To ensure an even distribution of keys across the hash table, reducing collisions.
To increase the speed of hash function computation.
To minimize the memory usage of the hash table.
To make the implementation of the hash table simpler.
What security risk arises from storing sensitive data like passwords directly in a hashmap, even when hashed?
An attacker gaining access to the hashmap could retrieve the plaintext passwords.
Hashmaps are inherently less secure than other data structures for storing passwords.
Storing any data in a hashmap increases the risk of SQL injection attacks.
Hash collisions could allow attackers to bypass authentication.
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
Linear Probing
Double Hashing
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?
O(log n)
O(n log n)
O(n)
O(1)
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
Queue
Linked list
Tree