Honestly, I think it is a naive assumption to make. If there actually were an imaginary perfect hash,. almost every problem could be mapped to it and be done in O(n)
So from what I've heard is that in an interview if you use these hashmaps and hash tables, you'll be asked on how to implement them. Now that'll mess it up, because what I previously said about hashing is true. On Mon, Sep 5, 2011 at 3:53 PM, Rajeev Kumar <[email protected]>wrote: > We can use linked HashMap................ > Refer : > http://download.oracle.com/javase/6/docs/api/java/util/LinkedHashMap.html > > > On Mon, Sep 5, 2011 at 1:42 PM, bharatkumar bagana < > [email protected]> wrote: > >> @Anup: >> how can u say that the hash function used is a%10 .... >> That is internal , not in the hands of user .. >> Usually while inserting a value in Hash Table , we don't give the size of >> the table ahead ... It decides some size, and implements.. when we cross the >> assumed size,then it again gives some more memory so that all the operations >> are optimum (less collisions)..... >> >> >> On Sun, Sep 4, 2011 at 5:32 PM, Anup Ghatage <[email protected]> wrote: >> >>> Sid, >>> >>> I'm afraid a hash table won't help much. >>> >>> Given the elements as follows: { 10,20,30,10,20,20,30,30,30,30,10 } >>> >>> All of them will be hashed into the 0'th cell for a % 10 hash function, >>> and then probably the overflow will be handled by chaining. >>> So that will be governed by m^2 in worst case. >>> >>> So the algorithm would be O( m^2 log m ) just to populate the hash and >>> find the frequencies. >>> >>> -- >>> Anup Ghatage >>> >>> -- >>> 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. >>> >> >> >> >> -- >> >> **Please do not print this e-mail until urgent requirement. Go Green!! >> Save Papers <=> Save Trees >> *BharatKumar Bagana* >> **http://www.google.com/profiles/bagana.bharatkumar<http://www.google.com/profiles/bagana.bharatkumar> >> * >> Mobile +91 8056127652* >> <[email protected]> >> >> >> -- >> 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. >> > > > > -- > Thank You > Rajeev Kumar > > -- > 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. > -- Anup Ghatage -- 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.
