Page 103 - Data Structures Handout_Neat
P. 103

This example demonstrates insertion, searching, and deletion in a simple hash table.

               Notice that collisions are not yet resolved, so inserting multiple keys with the same hash value
               will overwrite data.



                         9.3.3  Handling Collisions

                       Collisions occur when two keys map to the same index. Since collisions are inevitable,

               hash tables must use strategies to handle them. The two main approaches are chaining and
               open addressing.

                       Chaining

                       Chaining uses linked lists at each index. If multiple keys hash to the same index, they

               are stored in a linked list at that position. This ensures that no data is lost, but searching may
               take longer if the list becomes long.

                       Example: Hash Table with Chaining in C++

                                                            103
   98   99   100   101   102   103   104   105   106   107   108