Skip to content

Instantly share code, notes, and snippets.

@grauwoelfchen
Created June 12, 2013 18:44
Show Gist options
  • Save grauwoelfchen/5767962 to your computer and use it in GitHub Desktop.
Save grauwoelfchen/5767962 to your computer and use it in GitHub Desktop.
(define t-post-order
(lambda (t)
(if (t-empty? t)
'()
(append (t-post-order (t-left t))
(t-post-order (t-right t))
(list (t-value t)))) ))
(define t-post-order-r
(lambda (t)
(let aux ([t t] [res '()])
(if (t-empty? t)
res
(aux (t-left t)
(aux (t-right t)
(cons (t-value t) res))) ))))
(printf "post-order : ~s~n" (t-post-order my-tree))
(printf "post-order : ~s~n" (t-post-order-r my-tree))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment