Error in merging two sorted linked list

sir, i am writing the same code explained by sir in the video . But it is just merging the list and not sorting the merged list.

Code-> https://ide.codingblocks.com/s/601742

hi… ur logic was correct… just a small mistake…
image
here when u are building the linked list u have to insert the node at the tail not at the head… so just use insertAtTail function…

is ur doubt cleared???

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.