in DS recategorized
3,380 views
1 vote
1 vote

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).

  1. 3, 14
  2. 3, 10
  3. 4, 14
  4. 4, 10
in DS recategorized
3.4k views

1 comment

16,14,10,4,7,3,9,1,8,2 is the max heap formed and height is 3, right child is 10
0
0

3 Answers

2 votes
2 votes

Option (2) 3,10      

9 Comments

How 10 is a right child? Shouldn't the right child be 9
0
0
9 and 10 both are right children of the tree but according to the given options, we need to choose 10
1
1
Mam in the children we doesn't have any outgoing edge but 10 has an outgoing edge
0
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
0
Mam internal node is not same as leaf node
0
0
Where did I mention that it's the same?
0
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
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
0
0
Thanks
0
0
1 vote
1 vote

Answer is (2). 3,10

This is max heap and right of root is 10.

The depth is no. of edge from root to given node so depth is 3

0 votes
0 votes

 

normally
Caption

option b) is correct

Related questions