Second, I'm a little lost with regard to the
representation of a binary tree. For lists, inductively I have:
(a) /\
a nil
(a b) /\
a /\
b nil
and so on. Then how do I represent:
/\
a b
I believe we discussed this in class on 11/12. Your two lists
above can be represented as you have stated - (a) and (a b) -
or they can be represented in pair format - (a . nil) and (a b
. nil) respectively. I believe the .nil is normally allowed to
be ommited to simplify the representation of lists.
To answer your final question, the tree
/\
a b
can be represented by (a.b).
(Hopefully
somebody will correct me if I am horribly mistaken.)
Avi
|
trees vs. lists by Roni Choudhury, 2001, Nov 18
to: