this takes O(n^2) time right??? because we interchange 1st and nth node datas... then we can go to 1st node-> next node... but is there any efficient way to find the pointer of the (n-1)th node??? (without traversing from the beginning, as it takes O(n^2) time if we have to traverse from beginning to get the last node to be found... Also I am assuming O(1) space, so storing the pointers in an array doesnt help...
In short, is there any O(1)space and O(n) time solution? -- 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.
