/Delete the whole list.go Secret
Created
June 27, 2021 07:45
Star
You must be signed in to star a gist
Deleting the entire linked list
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
// DeleteList will delete the entire linkedlist. | |
// Deletion is inplace | |
func DeleteList(head **Node) { | |
fmt.Println("\nDeleting entire linkedlist") | |
var aux *Node | |
for (*head) != nil { | |
aux = (*head).Next | |
*head = nil | |
*head = aux | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment