Last active
November 4, 2015 17:31
-
-
Save chrisbrandow/96efef7b884e157a6ecf to your computer and use it in GitHub Desktop.
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
//Instead of: | |
func printAllKeys() { | |
var current: LLNode! = head | |
print("------------------") | |
while (current != nil) { | |
print("link item is: \(current.key)") | |
current = current.next | |
} | |
} | |
//what about: | |
func printAllKeys() { | |
print("------------------") | |
printAllKeys(head) | |
} | |
func printAllKeys(previous:LLNode<T>?) { | |
if let current = previous { | |
print("link item is: \(current.key)") | |
printAllKeys(current.next) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment