Why is a good hash function important for hashmap performance?
To allow for efficient resizing of the hash table.
To ensure that keys are evenly distributed across the hash table, reducing collisions.
To reduce the memory used by the hash table.
To minimize the number of comparisons required to find an element.
What does a hashmap store data in?
Key-Value Pairs
Sorted Array
Binary Tree
Linked List
How are dictionaries typically implemented in programming languages?
Using linked lists for fast insertions.
Using arrays for efficient indexing.
Using hashmaps to provide fast key-value lookups.
Using binary trees for sorted key storage.
What is the primary advantage of using a hashmap over a linear search in an array when searching for a specific value?
Hashmaps offer faster search times on average.
Hashmaps use less memory.
Hashmaps can store sorted data.
Hashmaps can handle duplicate values more efficiently.
What is a real-world application of hashmaps?
Performing depth-first search in a graph.
Storing and retrieving data in databases.
Compressing files to reduce storage space.
Sorting a list of numbers in ascending order.
Which of these data structures is commonly used to handle collisions in hashmaps?
Queue
Heap
Which collision resolution technique is commonly used in hashmaps?
Merge Sort
Binary Search
Bubble Sort
Separate Chaining
What is a key advantage of using a hashmap over a sorted array for searching?
Hashmaps offer faster search on average.
Hashmaps maintain data in sorted order.
Hashmaps allow duplicate keys.
Hashmaps consume less memory.
Which of the following is NOT a collision handling technique in hashmaps?
Linear Probing
Open Addressing
What is the time complexity of inserting a key-value pair into a hashmap in the average case?
O(n)
O(n log n)
O(log n)
O(1)