You are viewing a single comment's thread. Return to all comments →
Python. As discussed below, before that you need to write sys.setrecursionlimit(1750) because recursion depth of Python is set to 1000
def mergeLists(head1, head2): if not head1: return head2 if not head2: return head1 if head1.data < head2.data: head3 = head1 head3.next = mergeLists(head1.next, head2) else: head3 = head2 head3.next = mergeLists(head1, head2.next) return head3
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 →
Python. As discussed below, before that you need to write sys.setrecursionlimit(1750) because recursion depth of Python is set to 1000