What is linear probing in the context of open addressing for collision resolution?
Using a different hash function to avoid collisions.
Using a linked list to store colliding elements at the same index.
Resizing the hash table to accommodate more elements.
Probing for an empty slot by sequentially searching from the collision index.
What is the primary role of the modulo operator (%) in simple hash functions?
To generate a unique hash code for each key.
To handle collisions effectively.
To sort keys in ascending order based on their hash values.
To map the hash code to a valid index within the array's bounds.
If you were designing a simple hash function for strings, which operation would likely be a core component?
Reversing the string.
Finding the length of the string.
Converting characters to their ASCII codes and performing arithmetic operations.
Sorting the characters in the string alphabetically.
Which of the following data structures is commonly used to implement a hashmap?
Tree
Array
Linked List
Graph
Why is a good hash function important for hashmap performance?
To ensure that keys are evenly distributed across the hash table, reducing collisions.
To allow for efficient resizing of the hash table.
To minimize the number of comparisons required to find an element.
To reduce the memory used by the hash table.
Which collision resolution technique is commonly used in hashmaps?
Bubble Sort
Merge Sort
Separate Chaining
Binary Search
In hashmap collision resolution, what does separate chaining involve?
Using a secondary hash function to resolve collisions.
Finding the next available empty slot in the hash table.
Storing colliding elements in a separate overflow area.
Creating linked lists at each index of the hash table to store colliding elements.
In hashmap terminology, what does 'collision' refer to?
When two keys map to the same index in the hashmap.
When a hash function produces the same output for all inputs.
When two hashmaps have the same size.
When trying to delete a key that doesn't exist.
What does a hashmap store data in?
Binary Tree
Sorted Array
Key-Value Pairs
What is the purpose of a load factor in a hashmap?
To measure the efficiency of the hash function.
To store the maximum number of key-value pairs.
To count the number of collisions.
To determine when to resize the hashmap.