You are viewing a single comment's thread. Return to all comments →
js recursive
function mergeLists(head1, head2) { if (!head1) return head2 if (!head2) return head1 if(head1.data < head2.data){ return {"data": head1.data, "next": mergeLists(head1.next, head2)} }else{ return {"data": head2.data, "next": mergeLists(head1, head2.next)} } }
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 →
js recursive