Skip to content

Instantly share code, notes, and snippets.

@AahanSingh
Last active June 27, 2021 06:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AahanSingh/bc8b735d748d1098c4de6d3879777aad to your computer and use it in GitHub Desktop.
Save AahanSingh/bc8b735d748d1098c4de6d3879777aad to your computer and use it in GitHub Desktop.
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