Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Insert at the start of the list
func InsertAtStart(head **Node, x int) {
tmp := Node{Data: x, Next: nil}
fmt.Println("\nInserting", tmp, "at the start")
if *head == nil {
*head = &tmp
return
}
tmp.Next = *head
*head = &tmp
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment