During the search, if collision occurs, i.e you find more than one
entry in the specific location, you need to search the chain or rehash
it. To compare the key is the way to find the correct entry as key is
stored in every entry.
e.g your hash function is add the ascii code of every charactor
Hash("ab") will have the same value as Hash("ba") which is a+b
During the search, you search for "ab" and you will find it at
location a+b. There are two entries there. One is for "ab" and the
other is "ba". you need to compare the key and you will choose "ab".
That is the way.

On Mon, Jun 2, 2008 at 2:46 PM, Vinodh <[EMAIL PROTECTED]> wrote:
>
> If a hash collision occurs people resolve it some how moving to other
> empty locations by rehashing or by Chaining.
> Fine. I understand this in case of "insert".
>
> During "search" on a HashTable, what will happen if there is a
> collision? I mean if it points to a wrong index for a key value...Than
> we have retrieved the wrong record. How such a scenario is handled?
>
> Thanks,
> Vinodh
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/algogeeks
-~----------~----~----~----~------~----~------~--~---

Reply via email to