[plt-scheme] Excersise 14.2.3 - HtDP - Ordered list of binary tree nodes

From: Marco Morazan (morazanm at gmail.com)
Date: Fri Feb 20 16:51:22 EST 2009

> David. I don't know what (inorder (node-left BT)) should do and I
> believe what Veer said has a lot of truth, in that I really just don't
> understand how to navigate these tree's (I haven't looked at the link
> as instructed!). I have a vision that I should keep on checking
> (node-left bt) until it becomes false, and them I'm at the start of
> the list I want. However, when I try to crawl back across the right, I
> just get stuck, and my list just end ups with one or two items from
> the lowest left "triangle".
>

No, no, no......why are you thinking about checking left until some
condition is met? This type of dynamic thinking is a recipe - no pun
intended - for trouble.

Based on your own template, you only need to think about combining 3
expressions: (node-ssn BT), (inorder (node-left BT)), and (inorder
(node-right BT)) . That is all. Nothing more and nothing less. No
where in the DR recipe does it says think about going left, right, up,
down, or in any other direction until a condition is met.

With good reason, David told you to assume that (inorder (node-left
BT)) gives you the right result for, the BT, (node-left BT) and that
(inorder (node-right BT)) gives you the right result for, the BT,
(node-right BT).

-- 

Cheers,

Marco


Posted on the users mailing list.