Hash Tables Chaining using Doubly Linked Lists Multiple Choice Questions and Answers (MCQs)

Uncategorized

This set of Data Structures & Algorithms Multiple Choice Questions & Answers (MCQs) focuses on “Hash Tables Chaining using Doubly Linked Lists”.

1. What is the time complexity of delete function in the hash table using a doubly linked list?
A) O(1)

B) O(n)
C) O(log n)
D) O(n log n)

Explanation: The delete function in a hash table has an O time complexity (1). The hash function must be designed in such a way that the number of collisions is minimal.

2. Hashing can be used to encrypt and decrypt digital signatures.
A) true

B) false

Explanation: Encryption algorithms use hashing as well. Digital signatures are encrypted and decrypted with it.

3. What is the advantage of using a doubly linked list for chaining over singly linked list?
A) it takes less memory
B) it is easy to implement
C) it makes the process of insertion and deletion faster
D) it causes less collisions

Explanation: Using a doubly linked list decreases the amount of time it takes to complete a task. Though storing the extra pointer takes up more room.

4. Which of the following technique stores data in the hash table itself in case of a collision?
A) Open addressing

B) Chaining using linked list
C) Chaining using doubly linked list
D) Chaining using binary tree

Explanation: In the event of a collision, open addressing is used to store data in the table itself. Chaining, on the other hand, stores data in a different body.

5. Which of the following technique stores data in a separate entity in case of a collision?
A) Open addressing
B) Chaining using doubly linked list
C) Linear probing
D) Double hashing

Explanation: In the event of a collision, chaining of doubly linked lists is used to store data in a separate entity (in this case, a doubly linked list). Open addressing, on the other hand, stores it in the table itself.

6. Collision is caused due to the presence of two keys having the same value.
A) True

B) False

Explanation: The existence of two keys of the same value results in a collision. It can be dealt with using one of two methods: chaining or open addressing.

7. Which of the following is used in hash tables to determine the index of any input record?
A) hash function

B) hash linked list
C) hash tree
D) hash chaining

Explanation: A hash table is a type of data structure that is designed to allow for quick access to elements. In a hash table, hash functions are used to find the index of any input record.

8. What is the advantage of a hash table as a data structure?
A) faster access of data

B) easy to implement
C) very efficient for less number of entries
D) exhibit good locality of reference

Explanation: Hash tables are a type of data structure that allows for quick access to elements. In a hash table, hash functions are used to find the index of any input record.

9. What is the use of a hash function?
A) to calculate and return the index of corresponding data

B) to store data
C) to erase data
D) to change data
Explanation: The index for corresponding data is calculated and returned by the hash function. After that, the data is mapped in a hash table.

10. What is the time complexity of insert function in a hash table using a doubly linked list?
A) O(1)

B) O(n)
C) O(log n)
D) O(n log n)

Explanation: The insert function in a hash table has an O time complexity (1). The condition is that the number of collisions be kept to a minimum.

11. What is the time complexity of search function in a hash table using a doubly linked list?
A) O(1)
B) O(n)
C) O(log n)
D) O(n log n)

Explanation: The search function in a hash table has an O time complexity (1). The condition is that the number of collisions be kept to a minimum.

A hash table (also known as a hash map) is a data structure that implements an associative array abstract data form, which can map keys to values. A hash table employs a hash function to generate an index, also referred to as a hash code, into an array of buckets or slots from which the desired value can be retrieved. The key is hashed during lookup, and the hash indicates where the corresponding value is located. The hash function can allocate each key to a specific bucket in theory, but most hash table designs use an incomplete hash function, which could result in hash collisions if the hash function produces the same index for multiple keys.

Leave a Reply

Your email address will not be published. Required fields are marked *