Hashing and Methods used to implement hashing(Hashing with chaining and hashing with open addressing)
Hashing is a widely used class of data structures that support the operations of insert,delete and search on a dynamic set of keys S.These keys are mapped into a hash table using a hash function.The size of the hash table is usually within a constant factor of the number of elements in the current set S.
Hash table
Hash table consists of an array in which data is accessed via a special index called a key.The primary idea behind a hash table is to establish a mapping between the set of all possible keys and positions in the array using a hash function.A hash function accepts a key and returns its hash coding.Both computing a hash value and indexing into an array can be performed in constant time .Hashing can use it to perform constant time searches.
When two keys map to the same position they collide.A good hash function minimizes collisions but we must still be prepared to deal with them.
Application of hash tables
- Database systems.
- Symbol table.
- Data dictionaries.
- Hashing with chaining
- Hashing with open addressing.
- Division method.
- Multiplication method.
0 Comments