Open In App

GATE | GATE-CS-2014-(Set-2) | Question 49

Consider the expression tree shown. Each leaf represents a numerical value, which can either be 0 or 1. Over all possible choices of the values at the leaves, the maximum possible value of the expression represented by the tree is ___.


(A) 4
(B) 6
(C) 8
(D) 10

Answer: (B)
Explanation: An Expression Tree is a binary tree in which each internal node corresponds to operator and each leaf node corresponds to operand so for example expression tree for 3 + ((5+9)*2) would be:.



Below diagram shows values to pick to get the maximum value in expression tree




Quiz of this Question

Article Tags :