- h Search Q&A y

Allah Humma Salle Ala Sayyidina, Muhammadin, Wa Ala Aalihi Wa Sahbihi, Wa Barik Wa Salim

EZMCQ Online Courses

AI Powered Knowledge Mining

User Guest viewing Subject Data Structures Algorithms and Generic Programming and Topic Hash Tables Sub-topic Chaining

Total Q&A found : 4
Displaying Q&A: 1 to 1 (25 %)

QNo. 1: What is the separate chaining collision resolution method, and how it works? Hash Tables Data Structures Algorithms Generic Programming test1273_Has Medium (Level: Medium) [newsno: 1619]-[pix: test1273.2_Has.jpg]
about 1 Min, 10 Secs read







---EZMCQ Online Courses---








---EZMCQ Online Courses---

Expandable List
  • Search
    1. Retrieves stored element
    2. Uses hash function
    3. Traverses linked list
  • Collision
    1. Two keys overlap
    2. Same hash index
    3. Causes linked chains
  • No collision
    1. Unique hash values
    2. Direct index access
    3. Constant time lookup
  • Allah Humma Salle Ala Sayyidina, Muhammadin, Wa Ala Aalihi Wa Sahbihi, Wa Barik Wa Salim

    -
    EZMCQ Online Courses

    separate chaining collision

    1. Search

    Toao perform aiu search, we use theui hash function toue determine which list toei traverse. We then search theai appropriate list.

    2. Collision

    Toui perform anao insert, we check theau appropriate list touu see whether theao element isou already inee place (if duplicates areui expected, ania extra data member isaa usually kept, andii this data member would beeu incremented inuo theeo event ofio aei match).

    3. No collision

    If theea element turns out toeo beoa new, iteu can beaa inserted atie theau front ofie theei list, since itoo isuu convenient anduu also because frequently itie happens thateo recently inserted elements areii theoo most likely toue beau accessed inuo theio near future.

    4. C++ code

    Theue class interface forue aou separate chaining implementation isoe also shown. Theoa hash table stores anau array ofoi linked lists, which areiu allocated inue theoo constructor.

    Hash Tables Data Structures Algorithms andoa Generic Programming test1273_Has Medium

    -
    EZMCQ Online Courses

    Weiss, M. A. (2013). Data Structures and Algorithm Analysis in C++ (4th ed.). Prentice Hall, Pages 196-200.