You are viewing a single comment's thread. Return to all comments →
def insertNodeAtPosition(llist, data, position): New_node = SinglyLinkedListNode(data) if position == 0: # like insert_At_first New_node.next = llist llist = New_node else : New_Pos = position current = llist lenn = 0 while current.next: lenn += 1 if New_Pos == lenn : break current = current.next New_node.next = current.next current.next = New_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 →