Sunday, 20 January 2013

Hashing Techniques

By on 06:35

Hashing is a searching technique that is widely used in c ++,java,c# etc.It has the best case complexity as compared to other searching technique.Its best case complexity is equal to 0(1) means record search in first attempt.

Now I discuss different-2 functions/method and hash collision:-

1)Mid Square Method:-

We will take an example:-

=22031168110(a value)
=11*11=121(square of mid value)

So store data in 121 location.

2)Division/Remainder Method:-

We take an example:-

=2345782829394(a value)

So divide this above value with the closest prime number and store  the value in that divisor.

3)Folding Method:-

We take an example:-

=121|456|111|45(a single value)

So stored that value in 986 location.

Now we discuss hash collision techniques:-

4)Linear Probing:-It is the most simple technique of hashing because if collision occurs,then store value in another empty space.

5)Bucketing Method:-Another great technique of hashing which is used to avoid collision in hash table.

6)Chaining method:-It is the technique which is used in hashing to avoid collision in hash table.

If data comes at location 2 then it create a chain like a linked list.So it is the best hashing technique as compared to other technique.

That's all about Hashing Techniques or algorithm(in data structure and computer science)

If you have any query then leave your comments and don't forgot to follow me on Google+,Facebook,Twitter.


Post a Comment

Related Posts Plugin for WordPress, Blogger...