Re: [algogeeks] Print the string in reverse order (not revstr

2010-06-05 Thread Rohit Saraf
Ok. so you have a list. Iterating over it is linear isn't it? Ahh... you will need a doubly linked list or an arraylist.does it solve ur prob? -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://w

Re: [algogeeks] Print the string in reverse order (not revstr

2010-06-05 Thread Antony Vincent Pandian.S.
@Rohit I accept that tokenization is linear. But how do you say iteration over tokens in the new list and printing in reverse order as linear? On 6/5/10, Rohit Saraf wrote: > Tokenization is done in linear time. Just save the words in an list (And > what makes you think of non-linearity in tokeni

Re: [algogeeks] Print the string in reverse order (not revstr

2010-06-05 Thread Rohit Saraf
Tokenization is done in linear time. Just save the words in an list (And what makes you think of non-linearity in tokenization!) And then iteration over the tokens is trivially linear. -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Scienc

Re: [algogeeks] Print the string in reverse order (not revstr)

2010-06-05 Thread Antony Vincent Pandian.S.
Rohit, you are very well awake On Sat, Jun 5, 2010 at 9:49 AM, Rohit Saraf wrote: > Have you posted the same question twice or i am feeling sleepy? > > -- > -- > Rohit Saraf > Second Year Undergraduate, > Dept. of Computer Science and Engineerin

Re: [algogeeks] Print the string in reverse order (not revstr

2010-06-05 Thread Antony Vincent Pandian.S.
@Shobhit @Rohit Is it done it linear time?? I dont think so... On Sat, Jun 5, 2010 at 9:33 AM, Rohit Saraf wrote: > Tokenize the string and print it reverse! > > -- > -- > Rohit Saraf > Second Year Undergraduate, > Dept. of Computer Science and Eng

Re: [algogeeks] Print the string in reverse order (not revstr)

2010-06-05 Thread Lalit Rajora
Its simple... Reverse the whole string than reverse each word. an dthe work is done complexity O(n) This is a standard question of interview On Sat, Jun 5, 2010 at 9:49 AM, Rohit Saraf wrote: > Have you posted the same question twice or i am feeling sleepy? > > -- > -

Re: [algogeeks] Print the string in reverse order (not revstr)

2010-06-04 Thread Rohit Saraf
Have you posted the same question twice or i am feeling sleepy? -- -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14 -- You received this message because you are su

Re: [algogeeks] Print the string in reverse order (not revstr

2010-06-04 Thread Rohit Saraf
Tokenize the string and print it reverse! -- -- Rohit Saraf Second Year Undergraduate, Dept. of Computer Science and Engineering IIT Bombay http://www.cse.iitb.ac.in/~rohitfeb14 -- You received this message because you are subscribed to the Google

Re: [algogeeks] Print the string in reverse order (not revstr

2010-06-04 Thread Shobhit Bhatnagar
Reverse the string first and then reverse individual tokens. So, first we can reverse the whole string as "It is a fine morning" gets converted to "gninrom enif a si tI" and then reverse each token in the string so that end result would be the desired result. On Fri, Jun 4, 2010 at 8:01 PM, Raj

[algogeeks] Print the string in reverse order (not revstr)

2010-06-04 Thread Raj N
If I've a string like It is a fine morning, the algorithm has to print "morning fine a is It" and not "gninrom enif a si tI" The algo has to do this in linear time. Can someone help me out in this -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" grou

[algogeeks] Print the string in reverse order (not revstr

2010-06-04 Thread Raj N
If I've a string like It is a fine morning, the algorithm has to print "morning fine a is It" and not "gninrom enif a si tI" The algo has to do this in linear time. Can someone help me out in this -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" grou