You are viewing a single comment's thread. Return to all comments →
Python:
def insertNodeAtPosition(llist, data, position): size_list = 0 node = SinglyLinkedListNode(data) head = llist while llist.next: size_list+=1 if size_list == position: node.next = llist.next llist.next = node return head else: llist = llist.next return 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 →
Python: