Presentation is loading. Please wait.

Presentation is loading. Please wait.

Hashing is a method to store data in an array so that sorting, searching, inserting and deleting data is fast. For this every record needs unique key.

Similar presentations


Presentation on theme: "Hashing is a method to store data in an array so that sorting, searching, inserting and deleting data is fast. For this every record needs unique key."— Presentation transcript:

1

2 Hashing is a method to store data in an array so that sorting, searching, inserting and deleting data is fast. For this every record needs unique key.

3 The basic idea is not to search for the correct position of a record with comparisons but to compute the position within the array.  The function that returns the position is called the 'hash function‘.  The array is called a 'hash table'.  Each location in the hash table is called a cell or a bucket

4 In the other type of searching, we have seen that the record is stored in a table and it is necessary to pass through some number of keys before finding the desired one. While we know that the efficient search technique is one which minimizes these comparisons. Thus we need a search technique in which there is no unnecessary comparisons. If we want to access a key in a single retrieval, then the location of the record within the table must depend only on the key, not on the location of other keys(as in other type of searching i.e. tree). The most efficient way to organize such a table is an array. It is possible only with hashing.

5 The two principal criteria used in selecting a hash function are as follows:  The Hash function should be very easy and quick to compute.  The Hash function should uniformly distribute the hash addresses throughout the array so that there are a minimum number of collisions.

6 Divison Method Midsquare Method Folding Method


Download ppt "Hashing is a method to store data in an array so that sorting, searching, inserting and deleting data is fast. For this every record needs unique key."

Similar presentations


Ads by Google