You are viewing a single comment's thread. Return to all comments →
Simpler
Node* MergeLists(Node *a, Node*b) { if( !a) return b; if( !b) return a; if (a->data < b->data) { a->next = MergeLists(a->next, b); return a; } else { return MergeLists(b, a); } }
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 →
Simpler