@Arun Read Anup's comment "but It will go into O(n^2) for multiple occurrences of multiple words."
On Thu, Aug 25, 2011 at 8:06 PM, Arun Vishwanathan <[email protected]>wrote: > @anup: can u provide a sort of pseudocode as to how ur code is O(n)?firstly > u need to find out which word might have a repetition. so u compare first > character of first word with all the other first characters.if there is not > repetition , then u have to compare first character of second word with all > the first character of words ahead of it and so on till u might sense a > repetition.once u find a repetition u shift all the remaining words over the > duplicated word.this is O(n) again. > so are u doing this with a lot of pointers or how is that u keep it O(n) > overall? > > > On Thu, Aug 25, 2011 at 9:56 AM, sagar pareek <[email protected]>wrote: > >> thanks ankur khurana >> >> @dave >> May be u never did any mistake in posting and reading the problems. >> But dont think urself superior. >> Yeah i did mistake in reading the question so u must either ignore it or >> request me to not repeat it in future. >> You are behaving like its my daily routine of doing such kind of things. >> >> >> On Thu, Aug 25, 2011 at 11:56 AM, Anup Ghatage <[email protected]> wrote: >> >>> Actually, this method will be O(n) for any number of occurrences of a >>> single word, but It will go into O(n^2) for multiple occurrences of multiple >>> words. >>> >>> -- >>> 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. >>> >> >> >> >> -- >> **Regards >> SAGAR PAREEK >> COMPUTER SCIENCE AND ENGINEERING >> NIT 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. >> > > > > -- > "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. > -- 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.
