Skip to content

Instantly share code, notes, and snippets.

Created July 4, 2021 05:00
What would you like to do?
DL List deleting the first node
func DeleteFirst(head **DLNode) {
if *head == nil {
fmt.Println("\nList empty")
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