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
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
@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
@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
aaron.nar...@gmail.comwrote:
@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
@Sagar: And how do you use hashing without extra memory? Please,
please, please read the question, and don't bother to reply if you
can't answer it?
Dave
On Aug 24, 11:10 am, sagar pareek sagarpar...@gmail.com wrote:
use hashing
On Wed, Aug 24, 2011 at 8:43 PM, UMESH KUMAR
Dave: are you not too much rude here ? yes it is one's responsibility to
read the question but it is equally important to be humble . Same things can
be answered and asked in different tones. Just try to maintain yours.
Yours truly,
A fellow brainstorm-er .
On Thu, Aug 25, 2011 at 8:21 AM, Dave
@Ankur Garg: Please explain to me how my method uses extra memory?
--
You received this message because you are subscribed to the Google Groups Algorithm
Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to
@Anup: your method wont use extra memory.
your solution is correct. But i think we can find better soultion.
Duplicate means Not only it occured 2 times, it may be 2,3 4..etc..
so we have to consider that also. In that case complexity will go like
O(N^2) ,
N= number of words in line
Thanks