As per implementation can be done in log(n) using a self balancing bst.i am not sure but i think that is how c++ maps are implemented.this wud make the overall complexity o(n*m)+o (n*logn) though i am not sure if this is correct analysis
On 10/19/11, saurabh singh <[email protected]> wrote: > Sorting can be easily done in o(n) as number of chars will be > small(256) for ascii > > On 10/19/11, Arun Vishwanathan <[email protected]> wrote: >> also what would be a suitable hash function for the string? >> >> On Tue, Oct 18, 2011 at 1:21 PM, Arun Vishwanathan >> <[email protected]>wrote: >> >>> Hmm I see but if there are m max letters in each word and there are n >>> words >>> in the file, then each word sort is O(mlogm) and for n words so wont it >>> be >>> O(nmlogm)? >>> >>> >>> On Tue, Oct 18, 2011 at 12:55 PM, WgpShashank >>> <[email protected]>wrote: >>> >>>> Sort the all the string , Calculate hash-value , if the two has same >>>> hash >>>> vale they have to be anagram. put in group on the basis of anagram. >>>> leme know if i missed anything ? >>>> >>>> TC O(nlogm) n =number of words m is length of max string >>>> >>>> >>>> Shashank >>>> CSE,BIT Mesra >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups >>>> "Algorithm Geeks" group. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msg/algogeeks/-/FvPZTBiPMHgJ. >>>> 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. >>>> >>> >>> >>> >>> -- >>> "People often say that motivation doesn't last. Well, neither does >>> bathing - that's why we recommend it daily." >>> >>> >> >> >> -- >> "People often say that motivation doesn't last. Well, neither does >> bathing >> - that's why we recommend it daily." >> >> -- >> 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. >> >> > > > -- > Saurabh Singh > B.Tech (Computer Science) > MNNIT ALLAHABAD > -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- 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.
