Here i am again with a new question:
i'm in trouble about trees. Sometime i see like here
declare
fun {Size T}
case T
of nil then 0
[]tree(_ LT RT) then 1+{Size LT}+{Size RT}
end
end
is used the NIL. But sometime i see the LEAF in other examples like here
declare
R=tree(10 uno X1 X2)
X1=tree(5 due X3 X4)
X2=tree(15 tre X5 X6)
X3=tree(1 quattro leaf leaf)
X4=tree(7 cinque leaf leaf)
X5=tree(13 sei leaf leaf)
X6=tree(20 sette leaf leaf)
fun {Lookup X T}
case T
of leaf then notfound
[] tree(Y V T1 T2) then
if X==Y then found(V)
elseif X<Y then {Lookup X T1}
elseif X>Y then {Lookup X T2}
end
end
end
{Browse {Lookup 7 R}}
i don't understand why? When i have to use Nil and when LEAF please?
--
Caselle da 1GB, trasmetti allegati fino a 3GB e in piu' IMAP, POP3 e SMTP
autenticato? GRATIS solo con Email.it: http://www.email.it/f
Sponsor:
Apri subito Conto Arancio e ricevi 50 Euro di buoni acquisti da spendere
presso Media World!
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=10032&d=20100428
_________________________________________________________________________________
mozart-users mailing list
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users