[plt-scheme] Doubt Exercise 14.2.2 HTDP

From: Renato Dutra Luciano (renatoluciano at hotmail.com)
Date: Fri Mar 20 17:00:21 EDT 2009

Olá de novo, muito obrigado pelas informacoes, meu codigo ficou muito melhor e muito menor como vode pode ver.
porem a minha duvida com relacao a minha chamada recursiva persiste. continuo percorrendo a arvore duas vezes e que 
acredito nao ter necessidade. Gostaria muito de ajuda novamente.

Hi again, thanks for the informations, my code turned better and smaller like you can see. 
However my doubt about a self-referential persist. I continue searching in the binary tree two times and
I believe this is not needed (lines 52-54). Is there any suggestion?

Thanks!
Renato. 

> CC: plt-scheme at list.cs.brown.edu
> From: matthias at ccs.neu.edu
> Subject: Re: [plt-scheme] Doubt Exercise 14.2.2 HTDP
> Date: Fri, 20 Mar 2009 11:47:40 -0400
> To: renatoluciano at hotmail.com
> 
> 
> 
> Renato, your program is missing the data definition for BTs (though I  
> can infer it).
> 
> You did not follow the design recipe to design your function. As a  
> result,
>   -- it works by accident
>   -- and it is FAR MORE complex than needed.
> 
> Please go step by step. Design the template with these questions in  
> mind:
> 
>   1. How many clauses are in the data definition
>      That's how many clauses I need in the COND
>      Formulate appropriate conditions to separate these things.
> 
>   2. Which DD clauses introduce compound data
>      In the corresponding COND clauses, you need to write down  
> selector expressions
> 
>   3. Which DD clauses use self-references, and which pieces are  
> involved?
>      Add recursive calls around the corresponding selector expressions.
> 
> Then solve the problem as follows:
> 
>   A. Fill in the gaps in the non-recursive cases.
>   B. For the recursive cases:
> 	-- what do the various expressions compute
> 	-- how do you combine those results to get the final answers
> 
> Good luck -- Matthias
> 
> 
> 
> 
> 
> 
> 
> On Mar 19, 2009, at 5:06 PM, Renato Dutra Luciano wrote:
> 
> > Hi! I am Renato from Brazil. I am studying the 'How to Design  
> > Programs'.
> > In the Section 14  more specifically in the exercise 14.2.2 I have  
> > a doubt despite my tests are all passing.
> > While searching for a element on the binary tree, using the  
> > function Boolean?, my recursive function (search-bt) does one more
> > search than it should. (lines 49 - 54) Is there a better way???
> >
> > Thanks!
> > Dutra Luciano, Renato.
> > Veja mapas e encontre as melhores rotas para fugir do trânsito com  
> > o Live Search Maps! Experimente já!<14.2.2.exercise>
> > _________________________________________________
> >   For list-related administrative tasks:
> >   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 

_________________________________________________________________
Cansado de espaço para só 50 fotos? Conheça o Spaces, o site de relacionamentos com até 6,000 fotos!
http://www.amigosdomessenger.com.br
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20090320/a527055b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 14.2.2.exercise
Type: application/octet-stream
Size: 2938 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20090320/a527055b/attachment.obj>

Posted on the users mailing list.