
CSE 331: Homework 5 Spring 2009
Due by 11:59 PM Friday 27 Feb 2009
Submission
Submit your work via Handin. Name your file <name>Results.pdf, where
<name>is your last name, as in jonesResults.pdf.Please make sure that
your name and your MSU net ID (username) appear at the top of
every page and once at the beginning of any code that you may sub-
mit.You may lose points if you do not meet the submission criteria, something
especially likely if your name is missing from sheets on your homework. You
are also responsible for making sure that your assignment is submitted correctly
over Handin.
Problems:
Do the following problems. As always, we do not want just the “answers”, we
want the reasoning behind the answers. An answer that lacks proper justifica-
tion and reasoning will frequently lose several points.
1. (20 points) Explore the relationship between an expression tree and the
sequence generated by a tree traversal:
(a) Draw a binary expression tree for the following preorder sequence:
*+-bc+dae
(b) Is the tree in part a unique? Why or why not?
(c) Do preorder sequences generate unique trees? Why or why not (a
rigorous proof is not required)?
(d) Draw a binary expression tree for the following inorder sequence:
a-b*e+c+b
(e) Is the tree in part d unique? Why or why not?
(f) Do inorder sequences generate unique trees? Why or why not?
1