Please tell the error

hello @dhruvtrehan45
u r build function is not correct…

Made the correction, still not working

mistake is still there in inserttail function.
a) if head==null then create new node and make it head.
otherwise iterate till temp->next!=null
and then add new node at temp->next

do this correction inside ur midpoint function

in place of node * fast = head;
node * fast = head->next;

Reason:
As you have initialized both fast and slow with head,
So for a lined list of two elements, it will return slow as the second node of the list.
causing merge() function to stuck in an infinite loop as it will break the list into 2:0 ration for this returned value of mid.

not working https://ide.codingblocks.com/s/254338

bro u have shared some different link i think.

pls check and share the correct one

I make corrections as recommended by u and then save and send again the same code so the link changes

check ur updated code here-> https://ide.codingblocks.com/s/254723

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.