You are viewing a single comment's thread. Return to all comments →
I think you can trim one line out of your non-recursive solution:
def Insert(head, data): if head == None: return Node(data, None) curr_node = head while curr_node.next != None: curr_node = curr_node.next curr_node.next = Node(data, None) return head
Seems like cookies are disabled on this browser, please enable them to open this website
Insert a Node at the Tail of a Linked List
You are viewing a single comment's thread. Return to all comments →
I think you can trim one line out of your non-recursive solution: