You are viewing a single comment's thread. Return to all comments →
Python3 that would have been more efficient if _ _next__was implemented
def mergeLists(head1, head2): node = head1 node2 = head2 arr = [] while (node is not None): arr.append(node.data) node = node.next while (node2 is not None): arr.append(node2.data) node2= node2.next
arr.sort() sortedSLL=SinglyLinkedList() for i in arr: sortedSLL.insert_node(i) return sortedSLL.head
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 →
Python3 that would have been more efficient if _ _next__was implemented