Hashing Hashing is a technique used for storing and retrieving keys in a quicker option. A hash is a value computed from a base input number using a hashing function. In hashing, a string of characters is transformed into a usually shorter length value or key that represents the original string. Hashing is used to index and retrieve items in a database because it is faster to find an item using shorter hashed keys than to find it using the original value. Hash Table Hash table is an array where it stores the original string. The index of the table is the hashed key while the value is the original string. The size of the hash table is usually several orders of magnitude lower than the total number of possible string, so several strings might have the same hashed-keys. Example: Supposed we want to store 5 string: Apple, Fish, Banana, Dog, Chair into a hash table with size 26. The hash function we are gonna use is “transform the first letter o...
Posts
Showing posts from March, 2020