Regarding merge sort

here why we take node* merge without node* we can’t do ?

hello @ssmit_joshi

i didnt get ur question , pls elaborate a bit

why we are using node pointer here instead writing funtions like int ,or else

@ssmit_joshi

the function is taking head pointer of the two lists as its input thats why we have written node * in the function arguments.
and becuase the function is returning the head of merged list which is itself a pointer we have mentioned node * as its return type

and if we write the code with int as return type then send me the code how it would be

we cannot return int .becuase merge function is suppose to return head of the newly created list right?
and becuase head is pointer itself we need to use node * as its return type for any cases

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.