Skip to content

Instantly share code, notes, and snippets.

@esys
Created August 19, 2020 20:08
Show Gist options
  • Save esys/8b74a829956b7dc1a7b0e9f581db5faf to your computer and use it in GitHub Desktop.
Save esys/8b74a829956b7dc1a7b0e9f581db5faf to your computer and use it in GitHub Desktop.
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