The following questions refer to the following tree: Sound F/X How many levels d
ID: 3869092 • Letter: T
Question
The following questions refer to the following tree:
Sound F/X
How many levels does it have? How many branches (non-leaves) does it have? Which node values are stored in the branches? (Write them separated by commas, in ascending order by value.) How many leaves does it have? Which node values are stored in the leaves? (Write them separated by commas, in ascending order by value.) What value is stored at the root of the tree? Which node(s) are the sibling(s) of the node storing the value 2? (If there is more than one, write them separated by commas, in ascending order by value.) Which node(s) are the children of the node storing the value 2? (Write them separated by commas, in ascending order by value.)Explanation / Answer
Answers are below for each question ..rate if satisfied else comment for queries.
1. How many levels does the tree has ?
A. We define the level of a tree as the number of parent nodes a tree node has. The root of the tree, therefore, is at level 0. Root's children are at level 1, etc. In general, each level of a binary tree can have, at most, 2N nodes, where N is the level of the tree. To be counted as a level, the level must have at least one non-null node. The maximum level of the tree is the last such level.
Above tree has 2 levels , level 0 and level 1.....according to above level definition.
2.How many branches (non-leaves) does it have?
A. Above tree has 3 branches ...branch is a path from root node to leaf node . Hence 3 branches/paths..those are 3-5-1 , 3-2-4, 3-2-6.
3.Which node values are stored in the branches? (Write them separated by commas, in ascending order by value.)
A. Accordint to explanation from above answer ...,
1st branch - 1,3,5
2nd branch - 2,3,4
3rd branch- 2,3,6
4.How many leaves does it have?
A. A leaf node is one that doesnt have children to it. For the above tree ,there are 3 leaf nodes i.e., 1,4,6.
5.Which node values are stored in the leaves? (Write them separated by commas, in ascending order by value.)
A. 1,4,6 (See above explanation for leaf node)
6. What value is stored at the root of the tree?
A. Root of the tree is the node that is situated at top most level i.e., at level 0. Above tree's root is node with value 3.
7.Which node(s) are the sibling(s) of the node storing the value 2? (If there is more than one, write them separated by commas, in ascending order by value.)
A. Siblings of a binary tree are the ones with same parent ...From the above tree , for the node 2 , node with value 3 is its parent and there is only one other node as node (3) as its parent ,i.e., node with value 5 ...Hence Node 2 has sibling .i.e., 5 ......2 & 5 are siblings
8.Which node(s) are the children of the node storing the value 2? (Write them separated by commas, in ascending order by value.)
A.From the above tree , for the node 2 , nodes with values 4 , 6 are children.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.