You are viewing a single comment's thread. Return to all comments →
Also here is my Go solution:
func mergeLists(headA, headB *Node) *Node { if headA == nil { return headB } if headB == nil { return headA } if (headB.data < headA.data) { headB.next = mergeLists(headA, headB.next) return headB } else { headA.next = mergeLists(headA.next, 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 →
Also here is my Go solution: