If you were designing a simple hash function for strings, which operation would likely be a core component?
Converting characters to their ASCII codes and performing arithmetic operations.
Finding the length of the string.
Reversing the string.
Sorting the characters in the string alphabetically.
What happens when a hash function produces the same index for different keys?
The hashmap raises an error.
The hash function is automatically updated.
A collision occurs.
The key-value pair is discarded.
In hashmap terminology, what does a 'bucket' typically refer to?
The range of possible hash values produced by the hash function.
An individual element within the hashmap's array.
A linked list or other data structure used to handle collisions.
The load factor of the hashmap.
Which of these data structures is commonly used to handle collisions in hashmaps?
Linked List
Binary Tree
Queue
Heap
Which of the following is NOT a collision handling technique in hashmaps?
Linear Probing
Separate Chaining
Open Addressing
Binary Search
What is a disadvantage of using a hashmap?
Cannot iterate over elements in a specific order.
Inability to handle collisions.
Slow search speed.
Keys must be immutable.
In hashmap terminology, what does 'collision' refer to?
When two hashmaps have the same size.
When two keys map to the same index in the hashmap.
When a hash function produces the same output for all inputs.
When trying to delete a key that doesn't exist.
What is the primary advantage of using a hashmap over a linear search in an array when searching for a specific value?
Hashmaps use less memory.
Hashmaps can handle duplicate values more efficiently.
Hashmaps offer faster search times on average.
Hashmaps can store sorted data.
What is a disadvantage of using hashmaps when the number of elements to be stored is not known in advance?
They are less memory-efficient than arrays for storing a fixed number of elements.
They might require resizing, which can be an expensive operation.
They are more complex to implement than linked lists.
They are not suitable for storing data in a sorted order.
Which collision resolution technique is commonly used in hashmaps?
Bubble Sort
Merge Sort