[plt-scheme] Binary tree traversal, infix breadth first order
hi,
I want to make a function that walks through a tree in infix order and
in breath first order. I have made a function that uses depth first
order, but breadth first is more difficult I think.
The tree is represented in the following way: ’( (b) a ( ((f) d (g)) c
(() e (h)) ) ). The function should then return ’(a b c d e f g h)
my code, not very much:
(define (leaf? node)
(not (list? node))
)
(define (treewalk tree)
(cond
((leaf? tree) tree)
.....
)
)
thanks,