I'll appreciate comments on the solution proposed by me. It works the following way:
take two pointers, N1 and N2 pointing on the head of the list. Move N2 by two nodes, and N1 by a single node. When N2 reaches head again (or N2->Next is a head) then return N1 which will be pointing to the middle element of the list. Regards Umer Farooq On Sun, Mar 28, 2010 at 2:17 PM, Mukesh Kumar thakur < mukeshraj8...@gmail.com> wrote: > hi! in my opinion we can find the middle element in the singly linked which > hv the cycle........ > as we know the list doesnt support the concept of cycle coz it has only one > direction traversal........ > >> but if we take the case when the list hvng the no of element equal >> > as we hv : > n element in the list > we hv to find the middle one > in genral;;;;;simply we divide it in ......... > n/2; or > if consider middle elment as a key ;;;; > temp->link=null; > temp->first=middle > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > 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 algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.