Computer Science 245
Spring 2009
Homework 3: Tree Traversals & Heaps
Due Wednesday, February 25th, 3:30 p.m.
- For each of the following trees, show the order that the
nodes will be visited in a PREORDER, INORDER, and POSTORDER traversal:
- Tree 1:

- Tree 2:

- Tree 3:

- Tree 4:

- Draw all possible trees with the following PREORDER
traversal:
A B C
- Draw all possible trees with the following POSTORDER
traversal:
A B C
- How many different trees have the following PREORDER
traversal? You don't need to give all of the trees, just
count them.
A B C D
- The following elements are inserted (in this order) into a
min heap:
8 7 4 6 2 5 3 1
Show the resulting heap
Show the heap after 3 removemin operations