Created
August 19, 2020 20:08
-
-
Save esys/8b74a829956b7dc1a7b0e9f581db5faf 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
func DF(n *Node) { | |
s := Stack{} | |
current := n | |
for { | |
if s.IsEmpty() && current == nil { return } | |
if current != nil { | |
s.Push(current) | |
current = current.Left | |
} else { | |
current, _ = s.Pop() | |
current.Process() | |
current = current.Right | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment