-
-
Save AahanSingh/4f35a093363f03a8aca44651f6f13d28 to your computer and use it in GitHub Desktop.
DL List deleting the first node
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
func DeleteFirst(head **DLNode) { | |
if *head == nil { | |
fmt.Println("\nList empty") | |
return | |
} | |
fmt.Println("\nDeleting first Node: ", *head) | |
// We change head to point to the next Node | |
*head = (**head).Next | |
// To remove all references to the deleted node, set the Prev pointer of head to nil | |
if *head != nil { | |
(**head).Prev = nil | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment