take two ptrs ptr1 and ptr2 pointing to head move ptr1 until 1/4th of size of list. move ptr1 and ptr2 until ptr1=null ptr2 is pointing at 3/4th
surender On Tue, Jul 19, 2011 at 3:42 PM, SAMMM <[email protected]> wrote: > Yaa this will work , you need to handle the case for odd number of > nodes . > For even number of node it will serve the purpose . > > Yaa for the second part also you can use the ratio concept > > fast pointer : slow pointer = 4:3 > > slow = ptr->next->next->next > fast = ptr->next->next->next->next > > > Here also we need to handle the case if the number of node is not a > multiple of 4 . > > -- > 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.
