Data Structures | Tree Traversals | Question 6
Consider two binary operators ‘ ‘ and ‘‘ with the precedence of operator being lower than that of the operator. Operator is right associative while operator is left associative. Which one of the following represents the parse tree for expression (7 3 4 3 2)? (GATE CS 2011)
Since the precedence of is higher, the sub-expression () will be evaluated first. In this sub-expression, would be evaluated first because is right to left associative. So the expression is evaluated as . Also, note that among the two operators, first one is evaluated before the second one because the associativity of is left to right.
Quiz of this Question