Skip to content

Instantly share code, notes, and snippets.

@AahanSingh
Last active Jun 27, 2021
Embed
What would you like to do?
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