[an error occurred while processing this directive]

Expected Trees

Here are all 60 possible trees you should produce for question 9:
tiger
   cat
      dog
   feline

tiger
   cat
      dog
   feline

tiger
   cat
   feline
      dog

tiger
   cat
   feline
      dog

tiger
   feline
      dog
   cat

tiger
   feline
      dog
   cat

tiger
   feline
   cat
      dog

tiger
   feline
   cat
      dog

feline
   tiger
      cat
         dog

feline
   tiger
      cat
         dog

feline
   tiger
      cat
      dog

feline
   tiger
      dog
      cat

feline
   tiger
      cat
         dog

feline
   tiger
      cat
         dog

feline
   tiger
      cat
   dog

feline
   tiger
      cat
   dog

feline
   dog
   tiger
      cat

feline
   dog
   tiger
      cat

feline
   tiger
      cat
         dog

feline
   tiger
      cat
         dog

feline
   tiger
      cat
      dog

feline
   tiger
      dog
      cat

feline
   tiger
      cat
         dog

feline
   tiger
      cat
         dog

dog
   tiger
      cat
      feline

dog
   tiger
      feline
      cat

dog
   feline
      tiger
         cat

dog
   feline
      tiger
         cat

dog
   feline
      tiger
         cat

dog
   feline
      tiger
         cat

dog
   cat
      tiger
         feline

dog
   cat
      tiger
         feline

dog
   cat
      tiger
         feline

dog
   cat
      tiger
         feline

dog
   tiger
      cat
      feline

dog
   tiger
      feline
      cat

dog
   feline
      tiger
         cat

dog
   feline
      tiger
         cat

dog
   feline
      tiger
         cat

dog
   feline
      tiger
         cat

dog
   cat
      tiger
         feline

dog
   cat
      tiger
         feline

dog
   cat
      tiger
         feline

dog
   cat
      tiger
         feline

cat
   tiger
      feline
         dog

cat
   tiger
      feline
         dog

cat
   tiger
      dog
      feline

cat
   tiger
      feline
      dog

cat
   tiger
      feline
         dog

cat
   tiger
      feline
         dog

cat
   dog
   tiger
      feline

cat
   dog
   tiger
      feline

cat
   tiger
      feline
   dog

cat
   tiger
      feline
   dog

cat
   tiger
      feline
         dog

cat
   tiger
      feline
         dog

cat
   tiger
      dog
      feline

cat
   tiger
      feline
      dog

cat
   tiger
      feline
         dog

cat
   tiger
      feline
         dog 
Note that some pairs of trees print out identically. For example,
tiger
   cat
      dog
   feline

tiger
   cat
      dog
   feline
This is because in tree 1 the dog is the left child of cat, and in tree 2 the dog is the right child of cat. Our tree printing routine prints them indistinguishably.

Other trees are isomorphically equivalent. For example,

tiger
   cat
   feline
      dog

tiger
   feline
      dog
   cat
are equivalent — there is no meaning associated with being the left or right child, so if we swap the order of the children of tiger the two trees are equivalent.
CS216: Program and Data Representation
University of Virginia
David Evans
evans@cs.virginia.edu
Using these Materials