-
-
Save AahanSingh/cfc5c7db3eb4ba4383c74b8d2db1ca4b to your computer and use it in GitHub Desktop.
DL List traversal and length
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 DisplayList(head *DLNode) { | |
fmt.Printf("The list is: ") | |
for ; head != nil; head = head.Next { | |
fmt.Print(" -> ", head) | |
} | |
fmt.Println() | |
fmt.Println() | |
} | |
func Length(head *DLNode) int { | |
len := 0 | |
for ; head != nil; head = head.Next { | |
len++ | |
} | |
fmt.Println("Length = ", len) | |
return len | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment