Hashing is the process of transforming any given key or a string of characters into another value.
Hashing is a process of generating fixed-size output
from an input of variable size using mathematical formula known as hash
functions. The input can be of any size but output (hash value) will always be
a fixed length.
Hash stores the data in associative manner in an
array where each data value has its own unique index.
The hash data structure is used due to it’s efficiency. Using hash data structure,
it is easy to store data in constant time and retrive the data in constant
time. It takes O(1) time
in searching the data.
In hashing process there is a possibility that two
keys could produce the same value. The situation where the newly inserted key
maps to an already occupied cell is called collision.
There are two ways of handling collision
1. Seperate chaining
2. Open addressing
0 comments:
Post a Comment