More Re: Tree Representation 

Forum: Com Sci 221, U Chicago, Autumn 2001, Old Classwork
Re: News Assignment #7 due Monday, 19 November (Mike O'Donnell)
Re: Question dynamic scope? and tree representation? (Terry (Sotiria) Lampoudi)
Date: 2001, Nov 18
From: Avi Schwab ajschwab

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


Messages

1. Idea trees vs. lists by Roni Choudhury, 2001, Nov 18

to: "Re: Tree Representation"