Open In App

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

Like Article
Like
Save
Share
Report

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

GATECS2014Q38
(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

GATECS2014Q38



Quiz of this Question


Last Updated : 21 Dec, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads