What does the following program do on two linked lists?
Struct node *myFun (struct node * a, struct node * b)
{
Struct node *new = NULL ;
If (a = = NULL) return (b) ;
if (b = = NULL) return (a) ;
If (a → data <= b → data)
{
new = a ;
new → next = myFun (a → next, b) ;
return (new);
}
else
{
new = b ;
new → next = myFun (a, b → next) ;
return (new) ;
}
}
if options are
-
merges two unsorted linked lists
-
merges two linked lists by selecting the alternate nodes
-
merges two sorted linked lists into final sorted linked list
-
merges two linked lists by selecting the nodes in reverse.