@Karthikeyan : thanks for the reminder.....i totally forgot about Morris traversal..
i tried to tweak the code provided here : http://www.geeksforgeeks.org/archives/6358 This will meets the constraints , here is the code:- http://ideone.com/yp0jI unfortunately there is one thing which i am not able to figure out... as you can see i am using *goto* in the code.. it is not working if i use *continue* , i am not able figure out ...why this happening as using continue will make no effect.. may be i am missing something , so please help me in removing goto from the code. try running same code with continue instead of goto for input N=40. On Tue, Sep 4, 2012 at 12:56 PM, Navin Kumar <[email protected]>wrote: > @all: Now the problem is for getting O(n) time and O(1) space we have to > run two inorder traversal simultaneously. How can we do it?? > > > On Mon, Sep 3, 2012 at 9:31 PM, Karthikeyan V.B <[email protected]>wrote: > >> @navin and @atul: >> >> inorder traversal without recursion and stack can be done using Morris >> traversal in O(1) space. >> >> Refer the following link for Morris traversal >> >> http://www.geeksforgeeks.org/archives/6358 >> >> now the problem takes O(n) time and O(1) space. >> >> -- >> 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. > -- 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.
