Skip to content

Instantly share code, notes, and snippets.

@AahanSingh
Last active Jun 27, 2021
Embed
What would you like to do?
Insert at end inplace
func InsertAtEndInPlace(head **Node, x int) {
tmp := Node{Next: nil, Data: x}
if *head == nil {
*head = &tmp
} else {
var p *Node
p = *head
for ; p.Next != nil; p = p.Next {
}
p.Next = &tmp
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment