the code given by sir–
node* midPoint(nodehead){
if(head==NULL||head->next==NULL){
return head;
}
nodeslow=head;
node*fast=head->next; //MyDoubt
while(fast!=NULL && fast->next!=NULL){
fast=fast->next->next;
slow=slow->next;
}
return slow;
}
My doubt is in the 4th and the 5th line where slow pointer and fast pointer is initialized.So according to those 2 lines slow will point to the first node and fast will point to the second node before the loop begins.this means that the starting point of the slow and fast pointer is not same but i think that it should be same.According to me before the start of the loop( or say race) the starting point of both the pointers should be same.Please clear my doubt…