Skip to content

Instantly share code, notes, and snippets.

@AahanSingh
Last active June 27, 2021 07:13
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/82a4a8415ad0bea2ce27813d9d183fe2 to your computer and use it in GitHub Desktop.
Save AahanSingh/82a4a8415ad0bea2ce27813d9d183fe2 to your computer and use it in GitHub Desktop.
Delete node in-place
// DeleteFirstInPlace deletes the first node in a linkedlist.
// Deletion is inplace.
func DeleteFirstInPlace(head **Node) {
if *head == nil {
fmt.Println("\nList empty")
return
}
fmt.Println("\nDeleting first Node: ", *head)
*head = (**head).Next
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment