Getting Runtime Error, I am unable to find any error.
Link to my code
Getting Runtime Error, I am unable to find any error.
Link to my code
@S18LP0146
see the problem is with your midpoint finding technique.
According to your code, if the list is of size eg:- 1, 2 then it will find the midpoint as 2 and then in merge link list function, a will point to 1 and b will NULL (because mid point is 2 so next of 2 is NULL)
So, in this way your code will not be able to divide the linked list below the size of 2.
You can also check this by running it on your code.
So in midpoint technique function, take fast = head->next then it will be fine.
I get that. Thank you