TEZPUR 2025 — Computer PYQ
TEZPUR | Computer | 2025Which of the following is the primary reason for using a hash table in computer science?
Choose the correct answer:
- A.
To store elements in sorted order
- B.
To allow for efficient searching and insertion
(Correct Answer) - C.
To store elements that are linked together
- D.
To provide constant time complexity for sorting
To allow for efficient searching and insertion
Explanation
The correct answer is (b) To allow for efficient searching and insertion.
A hash table is a data structure that implements an associative array abstract data type, a structure that can map keys to values. Its primary advantage is its efficiency in performing data operations.
Efficiency: Hash tables use a hash function to compute an index into an array of buckets or slots, from which the desired value can be found. On average, this allows for O(1) time complexity for search, insertion, and deletion operations.
Comparison: Unlike sorted arrays or balanced binary search trees, which typically offer O(logn) performance for searches, hash tables excel when the order of data is not required.
We can represent the average time complexity T for common operations in a hash table as:
Tsearch≈O(1)
Tinsert≈O(1)
In contrast, operations like sorting in a hash table do not hold constant time complexity, as sorting requires O(nlogn) time, making options (a) and (d) incorrect.

