You are viewing a single comment's thread. Return to all comments →
Then ..this is simpler version:-
SinglyLinkedListNode*temp; if(head1==NULL && head2==NULL){ return NULL; } else if(head1!=NULL && head2==NULL){ return head1; } else if(head1==NULL && head2!=NULL){ return head2; } if(head1->data<=head2->data){ temp=head1; temp->next= mergeLists(head1->next,head2); } else{ temp=head2; temp->next= mergeLists(head1,head2->next); } return temp;
Seems like cookies are disabled on this browser, please enable them to open this website
Merge two sorted linked lists
You are viewing a single comment's thread. Return to all comments →
Then ..this is simpler version:-