How 10 is a right child? Shouldn't the right child be 9

The Gateway to Computer Science Excellence

0 votes

Consider the array A=<4, 1, 3, 2, 16, 9, 10, 14, 8, 7>. After building heap from the array A, the depth of the heap and the right child of max-heap are ______ and _____ respectively (Root is at level 0).

- 3, 14
- 3, 10
- 4, 14
- 4, 10

+2 votes

+1

9 and 10 both are right children of the tree but according to the given options, we need to choose 10

0

10 is the right child with respect to the root.When we say a tree in which every node has 0 or 2 children, we consider not only the leaf nodes as the children but the internal nodes also.correct me if I am wrong

0

Can you please provide the resource from where you have studied that "a tree in which every node has 0 or 2 children, we consider not only the leaf nodes as the children but the internal nodes also" ?

0

In computer science, a binary tree is a tree data structure in which each node has at most two children, which are referred to as the left child and the right child.

https://en.m.wikipedia.org/wiki/Binary_tree

https://en.m.wikipedia.org/wiki/Binary_tree

52,315 questions

60,433 answers

201,779 comments

95,257 users