You are viewing a single comment's thread. Return to all comments →
go golang solution
func insertNodeAtPosition(llist *SinglyLinkedListNode, data int32, position int32) *SinglyLinkedListNode { node := &SinglyLinkedListNode{data: data} if llist == nil { return node } curr := llist for i := 0;i < int(position-1);i++ { curr = curr.next } node.next = curr.next curr.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 →
go golang solution