Page 100 - Data Structures Handout_Neat
P. 100

9.2.4  Practical Examples of Hash Functions


                       Hash functions are applied in many practical scenarios:

                       •  Database indexing: Keys are hashed to quickly locate records.

                       •  Password security: User passwords are hashed before storage.

                       •  Caching: File names or URLs are hashed to determine cache locations.

                       •  Compilers: Variable names are hashed to manage symbol tables efficiently.
                       Example: String Hashing for Symbol Table in C++








































                       This example demonstrates how variable names can be hashed to efficiently manage
               a symbol table in a compiler. The polynomial rolling hash is widely used because it distributes

               strings more evenly across the table.



                9.3    Hash Tables

                       A hash table is the practical data structure that implements hashing. It stores data in

               an array-like structure where the position of each element is determined by a hash function

               applied to its key. The main advantage of hash tables is their ability to provide constant-time
               average performance for insertion, deletion, and search operations. This makes them one of

                                                            100
   95   96   97   98   99   100   101   102   103   104   105