You are viewing a single comment's thread. Return to all comments →
My python solution
def insertNodeAtPosition(llist, data, position): data = SinglyLinkedListNode(data) prev = None count = 0 node = llist while count < position: prev = node node = node.next count += 1 prev.next = data data = prev.next data.next = node return llist
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