- Visit the root
- Visit all the nodes in the left subtree
in preorder
- Visit all the nodes in the right subtree
in preorder
Desired behavior:
(display-preorder bushy-tree)
4 2 1 3 6 5 7
(define display-preorder
(lambda (tree)
(cond ((empty-tree? tree)) ; do nothing
(else (display (root tree))
(display " ")
(display-preorder (left-subtree tree))
__?__ ))))
|