You are viewing a single comment's thread. Return to all comments →
My Python solution, suggestions for improvement welcome:
def insertNodeAtPosition(llist, data, position): curr_head = llist for i in range(position - 1): llist = llist.next new_node = SinglyLinkedListNode(data) curr_next = llist.next llist.next = new_node new_node.next = curr_next return curr_head
Seems like cookies are disabled on this browser, please enable them to open this website
Insert a node at a specific position in a linked list
You are viewing a single comment's thread. Return to all comments →
My Python solution, suggestions for improvement welcome: