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

A complete binary tree is stored in an array called treeNodes, which is indicate

ID: 3763960 • Letter: A

Question

A complete binary tree is stored in an array called treeNodes, which is indicated from 0 to 99, as described in Section 8.9. The tree contains 85 elements. Mark each of the following statements as true or false, and explain your answers.

a.treeNodes [42] is a leaf node.

b. treeNodes[41] has only one child.

c. The right of child treeNodes[12] is treeNodes[25].

d. The subtree rooted at treeNodes[7] is a full binary tree with four levels.

e. The tree has seven levels that are full, and one additional level that contains some elements.

Explanation / Answer

0

1 2

3 4 5 6

7 8 9 10 11 12 13 14

15 16 17 1819 20 21 22 23 24 2526 27 28 2930

31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62

63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84

A full binary tree (sometimes proper binary tree or 2-tree) is a tree in which every node other than the leaves has two children. A complete binary tree is a binary tree in which every level, except possibly the last, is completely filled, and all nodes are as far left as possible.

Here it has 85 elements, starting from 0 to 84.

a.treeNodes [42] is a leaf node.

true, because it does not consist any child node.

b. treeNodes[41] has only one child.

false, because it has two child( treeNodes[83] and treeNodes[84])

c. The right of child treeNodes[12] is treeNodes[25].

false, because right of child treeNodes[12] is treeNodes[26]

d. The subtree rooted at treeNodes[7] is a full binary tree with four levels.

true, because in subtree of treeNodes[7] each node have two child and it have four level from 1 to 4.

e. The tree has seven levels that are full, and one additional level that contains some elements.

false, because tree has total level 7 from 1 to 7 that are not full and it does not has one additional level that contains some elements.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote