well space complexity should be mentioned in the question then, anyway, start with the second element put it at its correct location(say x), then take x put it at its correct location, this was when you do this n-1 time, you will get the correct answer because it forms a cycle.
On Mon, Feb 28, 2011 at 11:33 PM, bittu <[email protected]> wrote: > @arpit otherwise it wont b amzon quest.. > space dude..space is constants > > > Thanks > Shashank > > -- > 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.
