Take 2 node pointers.Move one at the speed of twice the other(first:node->next,second:node->next->next) when the first pointer reaches the end of the list,the second will give you the middle node.
On Tue, Jul 19, 2011 at 3:27 PM, shilpa gupta <[email protected]>wrote: > give your algo..... > > > On Tue, Jul 19, 2011 at 3:26 PM, SAMMM <[email protected]> wrote: > >> O(n) is possible . Will it serve the purpose or need less than that ??? >> >> -- >> 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. >> >> > > > -- > Shilpa Gupta > > B.Tech. 3rd year > Computer Science and Engineering > MNNIT Allahabad > > > -- > 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. > -- Archita Monga -- 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.
