Code is not working. May be any infinite loop/recursion is there.
Code not working
There’s some error in your mid point function only, try solving the segmentation error in that, also would like to give you a better approach to find mid point of a linked list:-
node* midpoint(node* head){
node* slow = head, *fast = head->next;
while(slow && fast && fast->next)
{
slow = slow->next;
fast = fast->next->next;
}
return slow;
}
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.