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

#1 There is a tree with a total of 26 nodes: the root + the left subtree (which

ID: 3721455 • Letter: #

Question

#1

There is a tree with a total of 26 nodes: the root + the left subtree (which contains 20 nodes) + the right subtree (which contains 5 nodes). For preorder, inorder, and postorder traversals, how many nodes are processed before the root?

preorder

iborder

postorder

Choices 13, 5, 0, 20, 25?

#2

Assume that the variable data refers to the string "I am hungry!".

The expression len(data) evaluates to: ?

#3

Write a Python statement to create a dictionary named partners, that maps "Serena" to "Venus" and maps "Bob" to "Mike"? In these two cases "Serena" and "Bob" are the keys and "Venus" and "Mike" are the values.

Explanation / Answer

Ques 1.

Inorder : Answer : 20

It is because in te inorder traversal, first we traverse the left subtree, then the root node and then the right tree.

Preorder : Answer : 0

It is because in te preorder traversal, first we traverse the root node. So, no node is processed before the root.

PostOrder : Answer : 25

It is because in the postorder, the root node is the last to be accessed.

Ques 2. Answer : 12

len() function returns the length of string. The length of given string is 12.

Ques 3.

dict = { "Serena" : "Venus" ,  "Bob" : "Mike" }