how fast is initiallised to head->next , because in video sir told that for odd nos of nodes slow and fast starts at same point.
How fast is initiallised to head->next , because in video sir told that for odd nos of nodes slow and fast starts at same point
@Rahulkr102
For a linked list with even no of nodes , we can clearly see that we would have two mid points. In this code , we are taking the second mid as our mid pointer . Both are valid. This fast = head->next initialisation will not have any effect in case of odd no of elements however in case of even no of elements , it will resolve the issue two mids by taking second one as mid.
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.