And amortization of growing the table when N reaches the capacity. On Sun, Apr 3, 2011 at 7:46 AM, vaibhav agrawal <[email protected]> wrote: > For implementing a HashMap, I believe following things need to be > determined: > > 1. Good Hashing Function > 2. Allocation of an array of pointers containing the structure of the key > and values to be stored. The size of array could be determined, based on the > number of key/value pairs to be stored, and how much memory is available or > how fast we want the HashMap to work. > > Working: > 1. Storage: > Any key/value pair need to be stored, the key would be passed to the hash > function to get the index of the array where the key/value pair need to be > stored. If already a key/value is stored there, then a chain would be > created. > > 2. Look-up: > Any key which need to be looked upon, the key would be passed to the hash > function to get the index of the array where the key/value pair is stored. > The chain stored at that index, would be then looked sequentially to find > out the value. If none of the node contains the key, then key is not present > in HashMap. > > Thanks, > Vaibhav > > > On Sun, Apr 3, 2011 at 6:52 PM, rAun007 <[email protected]> wrote: >> >> Hi Geeks, >> >> I was trying to find a good approach to implement a Hash Map of your >> own but got confused by searching the answer on the net. >> >> It would be very much appreciated if we can discuss different >> approaches and the best way to implement the same. >> >> >> Regards, >> >> Raunak >> >> -- >> 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?hl=en. >> > > -- > 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?hl=en. >
-- Cheers, hammett http://hammett.castleproject.org/ -- 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?hl=en.
