Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Answer the following questions about treeA a. What are the ancestors of node P?

ID: 3763985 • Letter: A

Question

Answer the following questions about treeA

a. What are the ancestors of node P?

b. What are the descendants of node K?

c. What is the maximum possible number of nodes at the level of node W?

d. What is the maximum possible number of nodes at the level of node N?

e. What is the order in which the nodes are visited by an ignorer traversal?

f. What is the order in which the nodes are visited by a preorder traversal?

g. What is the order in which the nodes are visited by a postorder traversal?

treeA SH

Explanation / Answer

a) ancestors of node P are M,K,Q

   ancestor is a node reachable by repeated procedure from child to parent.so from P to Q

b) descendants of node K are M,P,N

   descendant is anode reachable by repeated procedure from parent to child. so from K to N

c) W can have 2^n-1 nodes = 2^4-1=15 nodes. n is te level

d) N can have 2^5-1 = 31 nodes.

e) inorder:

following are the operations

1)traverse the left subtree starting with left externalnode

2) visit the root

3) traverse the right subtree starting at the left external node.

B,J,D,K,Q,N,P,M,R,W,Y,T

f) preorder traversal:

following operations are to be done:

1) visit the root node

2) traverse the left subtree

3) traverse the right subtree

Q,K,D,B,J,M,P,N,T,R,Y,W

g) post order:

following are the operations

1) traverse all the left exaternal nodes

2)traverse the right sub tree starting at the left external node.

3)visit the root node.

B,J,D,P,M,K,R,W,Y,T,Q