You are viewing a single comment's thread. Return to all comments →
The various solutions in this thread can be further simplified to
if (headA == null) return headB; if (headB != null) { if (headA.data < headB.data) { headA.next = MergeLists(headA.next, headB); return headA; } headB.next = MergeLists(headA, headB.next); return headB; } return headA;
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 →
The various solutions in this thread can be further simplified to