Why we took fast as head->next and slow as head? And One more doubt like we take slow as head, So as head is pointing on the first element of the linked lists so means slow is also same or slow is like another name for the head variable.
Why we took that one?
slow and fast are just pointers to traverse the Linked List. You just need to ensure here in runner technique is that fast pointer traverses at the rate of 2 nodes at a time whereas slow pointer traverses at the rate of 1 node at a time. So you can initialize fast and slow as head also.
Sir Please also tell about pointers. Like When we write nodeslow=head, it means that slow is at first element of linked lists or it is just like the another name of the head node. And when we write like nodefast=head->next, What does that mean and What does that point to?
It is another pointer variable(another name) which is pointing to the head.slow and fast are just pointer variables which initially point to the head node. and then traverses accordingly as i have explained above. For more clarity please watch the video again.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.