CPSC 220 HW2: Trees
- Draw a tree whose preorder traversal is a b c d e and whose
inorder traversal is b a d c e.
- Draw a tree whose inorder traversal is f a g b h d i c j e and whose
postorder traversal is f g a h i d j e c b.
- Give an example of a binary tree with more than one node whose
inorder and postorder traversals yield the same list of nodes.
- Find two different trees that have the same list of nodes under a preorder
traversal.
- For your BinaryTree class from prog1,
write a recursive method int height() that returns the height of
the tree.
- For your BinaryTree class from prog1,
write a recursive method int numNodes() that returns the
number of nodes in the tree.