Given an expression tree evaluate the expression tree
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
total answers (1)
Expression tree:
Any infix expression can be converted to an expression tree whose leaf nodes are all operands & intermediate nodes are operators.
Algorithm to evaluate an expression tree
Expression tree can be evaluated using the following algorithm
This can be constructed using a recursive function evalTree (root of expression tree)
Pre-requisite functions:
isOperator(string s) = Boolean function to check whether root data is operator or not
C++ implementation:
Output