Data Structure Questions and Answers-Hash Tables

 

 Help authour, Buy PDF Ebook   >>>Click Here<<<

Data Structure Questions and Answers-Hash Tables

Question 1
What is a hash table?
A
A structure that maps values to keys
B
A structure that maps keys to values
C
A structure used for storage
D
A structure used to implement stack and queue
Home science Questions answers
Question 1 Explanation: 
A hash table is used to implement associative arrays which has a key-value pair, so the has table maps keys to values.

Question 2
If several elements are competing for the same bucket in the hash table, what is it called?
A
Diffusion
B
Replication
C
Collision
D
None of the mentioned
Reading comprehension Questions answers
Question 2 Explanation: 
None.

Question 3
What is direct addressing?
A
Distinct array position for every possible key
B
Fewer array positions than keys
C
Fewer keys than array positions
D
None of the mentioned
Microbiology Questions answers
Question 3 Explanation: 
Direct addressing is possible only when we can afford to allocate an array that has one position for every possible key.

Question 4
What is the search complexity in direct addressing?
A
O(n)
B
O(logn)
C
O(nlogn)
D
O(1)
UPSC Questions answers
Question 4 Explanation: 
Since every key has a unique array position, searching takes a constant time.

Question 5
What is a hash function?
A
A function has allocated memory to keys
B
A function that computes the location of the key in the array
C
A function that creates an array
D
None of the mentioned
Visual arts Questions answers
Question 5 Explanation: 
In a hash table, there are fewer array positions than the keys, so the position of the key in the array has to be computed, this is done using the hash function.

There are 5 questions to complete.

 

 Help authour, Buy PDF Ebook   >>>Click Here<<<