[plt-scheme] Binary tree traversal, infix breadth first order

From: John Clements (clements at brinckerhoff.org)
Date: Wed Nov 19 21:55:27 EST 2008

On Nov 18, 2008, at 8:16 AM, Derk wrote:

> 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)
>       .....
>    )
> )

What step of the Design Recipe are you on?

(www.htdp.org)

John Clements

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2484 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20081119/a440558a/attachment.p7s>

Posted on the users mailing list.