CoolInterview.com - World's Largest Collection of Interview Questions
Send Free SMS
 Interview Questions  
 Our Services  


INTERVIEW QUESTIONS LANGUAGES C DETAILS
Question :
What is hashing?
Category C Interview Questions
Rating (4.3) By 67 users
Added on 10/22/2004
Views 18435
Rate it!
Answers:

To hash means to grind up, and that?s essentially what hashing is all about. The heart of a hashing algorithm is a hash function that takes your nice, neat data and grinds it into some random-looking integer.

The idea behind hashing is that some data either has no inherent ordering (such as images) or is expensive to compare (such as images). If the data has no inherent ordering, you can?t perform comparison searches.

If the data is expensive to compare, the number of comparisons used even by a binary search might be too many. So instead of looking at the data themselves, you?ll condense (hash) the data to an integer (its hash value) and keep all the data with the same hash value in the same place. This task is carried out by using the hash value as an index into an array.

To search for an item, you simply hash it and look at all the data whose hash values match that of the data you?re looking for. This technique greatly lessens the number of items you have to look at. If the parameters are set up with care and enough storage is available for the hash table, the number of comparisons needed to find an item can be made arbitrarily close to one.

One aspect that affects the efficiency of a hashing implementation is the hash function itself. It should ideally distribute data randomly throughout the entire hash table, to reduce the likelihood of collisions. Collisions occur when two different keys have the same hash value. There are two ways to resolve this problem. In ?open addressing,? the collision is resolved by the choosing of another position in the hash table for the element inserted later. When the hash table is searched, if the entry is not found at its
hashed position in the table, the search continues checking until either the element is found or an empty position in the table is found

The second method of resolving a hash collision is called ?chaining.? In this method, a ?bucket? or linked list holds all the elements whose keys hash to the same value.

When the hash table is searched, the list must be searched linearly.





To search for an item, you simply hash it and look at all the data whose hash values match that of the data you?re looking for. This technique greatly lessens the number of items you have to look at. If the parameters are set up with care and enough storage is available for the hash table, the number of comparisons needed to find an item can be made arbitrarily close to one.



 Posted by: ANANTH HERO    

Contact ANANTH HERO  Contact ANANTH HERO

The process of mapping the large amount of data in to the smaller table is called as hashing



 Posted by: Ruhi    

Contact Ruhi  Contact Ruhi

In simple words the process of mapping the large amount of data in to a smaller table is called as hashing



 Posted by: Ruhi    

Contact Ruhi  Contact Ruhi

Hashing is a search technique in which the searching time is independent on number of items



 Posted by: Naikwadi Sambhaji Uddhav    

Contact Naikwadi Sambhaji Uddhav  Contact Naikwadi Sambhaji Uddhav


If you have the better answer, then send it to us. We will display your answer after the approval.
Name :*
Email Id :*
Answer :*
Verification Code Code Image - Please contact webmaster if you have problems seeing this image code Not readable? Load New Code
Process Verification  Enter the above shown code:*
Inform me about updated answers to this question

   
Related Questions
View Answer
How can I sort a linked list?
View Answer
How can I search for data in a linked list?
View Answer
How do you redirect a standard stream?
View Answer
How can you restore a redirected standard stream?
View Answer
What is the difference between text and binary modes?
View Answer
How do you determine whether to use a stream function or a low-level function?
View Answer
How can I open a file so that other programs can update it at the same time?
View Answer
How can I make sure that my program is the only one accessing a file?
View Answer
What is Preprocessor?
View Answer
What is a macro, and how do you use it?
View Answer

Please Note: We keep on updating better answers to this site. Subscribe to our newsletter to get notified when better answer is posted.

Notify me when better answer is posted!
Email:

View ALL C Interview Questions

User Options
Sponsored Links


Copyright ©2003-2010 CoolInterview.com, All Rights Reserved.
Privacy Policy | Terms and Conditions
Page URL: http://www.coolinterview.com/interview/1043/default.asp?cachecommand=bypass


Download Yahoo Messenger | Placement Papers| FREE SMS | ASP .Net Tutorial | Web Hosting | Free SMS | Dedicated Servers | Joke of the Day

0.66