1 votes 1 votes Which of the following is a valid heap? $a$ $b$ $c$ $d$ DS ugcnetjan2017ii data-structures binary-heap + – go_editor asked Mar 24, 2020 edited Jan 21, 2023 by makhdoom ghaya go_editor 1.5k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
7 votes 7 votes all option are false Option A is violated max heap property because 8 is greater than his root. Option B is violated max heap property because 8 is greater than his root. Option C is violated max heap property because 7 is greater than his root. Option D is violated max heap property because 9,10,8,7 elements are greater than his root. Mohit Kumar 6 answered May 7, 2020 Mohit Kumar 6 comment Share Follow See all 0 reply Please log in or register to add a comment.
3 votes 3 votes OPTION (B) This is only tree which follows the property of max heap. junaid ahmad answered Oct 8, 2017 junaid ahmad comment Share Follow See all 0 reply Please log in or register to add a comment.
3 votes 3 votes In binary search tree root is greater than left Subtree and less than right subTree but in heap there are two cases Case1:Max heap:Root is maximum in this if not then we have to heapify Case 2:Min heap:Root is minimum in this if not then we have to do heapify A) no because of 4 B) yes C) no because of 1 D) same as c So option b Rishi yadav answered Oct 11, 2017 Rishi yadav comment Share Follow See 1 comment See all 1 1 comment reply Asha kotadiya commented May 26, 2020 reply Follow Share Option A and B are same 0 votes 0 votes Please log in or register to add a comment.
1 votes 1 votes A , D , C are invalid As there are child>parent case A: 8>4 C: 7>1 D: 10>3 only B is valid heap... parents>children Debasmita Bhoumik answered Feb 4, 2017 Debasmita Bhoumik comment Share Follow See 1 comment See all 1 1 comment reply Sankaranarayanan P.N commented Jul 26, 2017 reply Follow Share This is the case of a max heap. in min heap parent < child 0 votes 0 votes Please log in or register to add a comment.