Purpose: the purpose of this assignment


Purpose: The purpose of this assignment is to give you exercise to

Become familiar with tree, binary tree

Become familiar with linked binary tree structure and array-based binary

tree structure

Exercise 1:

For the following tree, answer following questions:

a. Which node is the root?

b. What are the internal nodes?

c. How many descendents does node cs016/ have?

d. How many ancestors does node cs016/ have?

e. What are the siblings of node homeworks/?

f. Which nodes are in the subtree rooted at node projects/?

g. What is the depth of node papers/?

h. What is the height of the tree?

Exercise 2:

1. Draw a (single) binary tree T such that:

a. Each internal node of T stores a single character

b. A preorder traversal of T yields EXAMFUN

c. An in order traversal of T yields MAFXUEN

2. Assume the above binary tree is arranged in a Linked binary tree structure, draw a figure to represent the binary tree [hint: take a look at figure 7.14]

3. Discuss the pros and cons of the array-list representation of a binary tree.