A max-heap is a heap where the value of each parent is greater than or equal to the value of its children. Which of the following is a max-heap?
(A)
(B)
(C) .
(D)
in option (A) - it is not a max heap because it is not complete binary tree . in option (C) - it is complete binary tree but not follow the max heap property i.e. the values of parent nodes always greater then child nodes and there node of value $5$ is less then on e of its children. in option (D) - similar to above (C) option explanation here node of value $2$ is less then to the value $4$ .
correct option is (B) that is satisfy both properties and all of the max heap .
Gatecse