Which data structure uses a "hash function" to store and retrieve data?

2025

Which data structure uses a "hash function" to store and retrieve data?

Answer: C. Hash TableAnswer: Hash Table Explanation: Hash tables use a hash function to map keys to indices in an underlying array, allowing efficient storage and retrieval of…

  1. A.

    Array

  2. B.

    Linked List

  3. C.

    Hash Table

  4. D.

    Tree

Attempted by 764 students.

Show answer & explanation

Correct answer: C

Answer: Hash Table

Explanation: Hash tables use a hash function to map keys to indices in an underlying array, allowing efficient storage and retrieval of values by key.

  • A hash function converts a key into an index where the value is stored.

  • Collisions (different keys mapping to the same index) are handled by methods such as chaining (storing a list at each bucket) or open addressing (probing for another slot).

  • Average-case time complexity for lookup, insertion, and deletion is O(1); worst-case can degrade to O(n) if many collisions occur.

  • Common uses include implementing dictionaries/maps, sets, and caches where fast key-based access is required.

Explore the full course: Coding For Placement

Loading lesson…