How are dictionaries typically implemented in programming languages?
Using binary trees for sorted key storage.
Using arrays for efficient indexing.
Using hashmaps to provide fast key-value lookups.
Using linked lists for fast insertions.
You want to update the value associated with a key in a hashmap. What is the general process involved?
Hashmaps do not support value updates; you need to create a new hashmap.
Calculate the hash of the key, find the corresponding bucket, and directly modify the value.
Search for the key sequentially, and update the value when found.
Delete the existing key-value pair, then insert a new one with the updated value.
What does a hashmap store data in?
Sorted Array
Key-Value Pairs
Binary Tree
Linked List
Why are hash functions typically designed to be fast to compute?
To maintain the sorted order of keys.
To ensure efficient insertion, deletion, and search operations.
To minimize memory usage.
To prevent data loss during collisions.
In hashmap collision resolution, what does separate chaining involve?
Finding the next available empty slot in the hash table.
Creating linked lists at each index of the hash table to store colliding elements.
Storing colliding elements in a separate overflow area.
Using a secondary hash function to resolve collisions.
Which characteristic of a hash function is undesirable and can lead to performance degradation?
Fast Computation
High Collision Rate
Uniform Distribution
Deterministic
Which of the following is NOT a collision handling technique in hashmaps?
Open Addressing
Linear Probing
Binary Search
Separate Chaining
Which of these data structures is commonly used to handle collisions in hashmaps?
Heap
Queue
What is a disadvantage of using a hashmap?
Slow search speed.
Keys must be immutable.
Inability to handle collisions.
Cannot iterate over elements in a specific order.
What is a real-world application of hashmaps?
Performing depth-first search in a graph.
Storing and retrieving data in databases.
Sorting a list of numbers in ascending order.
Compressing files to reduce storage space.