Why is there a segmentation fault in the code:
Linked List K reverse problem
@Chirag-Jain-1414278322030453 Your code doesn’t seems to correct. Explain your approach the way you are doing it.
I am reversing the list in sublists of ‘k’, head points to head of sublist, originalhead is a node to store the head value as it will change in the reverseK function, after executing the function, temp2 points to head of next sublist, sublast is node of end point of (unreversed) next sublist, hence originalhead now points to sublast and so the function goes on repeating the same procedure.
I hope you have solved it now as we talked on chat.
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.