On Jan 6, 2:54 pm, Vijay <hello_mis...@rediffmail.com> wrote: > Hi All, > > I have one question about Hashing. > > Say I have one Hash table where > index Hash_function(key) function will return index value of > corresponding string/key. > Hash_insert(key) function it will take key and get converted index > value using Hash_function(key) and insert into two dimensional > > Array[index][data] -> > [1]["Hello"] > [2]["ss"] > [3]["World"] > > To deal with collision we will use Liner probing or a separate > function which will increment the index to next location in array if > collision occurred. > > I understand, to lookup or search value/data we need to use > Hash_function again to get index and then search in array/table. > > My question is -> in case of Liner probing, how we will retrieve the > data corresponding to key? > > Lets say, there are keys "Hello" and "World". and Hash_function will > return 1 as index for both so collision occurred. And Hash_insert will > insert "World" at index 3 as 2 is already filled. > > Now how searching function will retrieve correct data? > > Liner probing is described here > ->http://www.cs.auckland.ac.nz/software/AlgAnim/hash_tables.html > Hope I am clear. Thanks in advance.
Don't really see the problem. Just compare the keys. -- Geoff
-- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.