-
-
Save AahanSingh/82a4a8415ad0bea2ce27813d9d183fe2 to your computer and use it in GitHub Desktop.
Delete node in-place
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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