Question: (c) An expression tree is a trec used to represent mathematical expressions. It is such that the leaves contain the operands (eg. constants and variables)

(c) An expression tree is a trec used to represent mathematical expressions. It is such that the leaves contain the operands (eg. constants and variables) and the remaining nodes contain the operators (e.g. addition, multiplication, square root). Using pseudo-code or C code, write an algorithm to recursively print out the values of the nodes in a pointer-based implementation of a binary tree, using an in-order traversal strategy. Implement the function such that it produces a parenthesised mathematical expression. For example, the output expression that the function would produce in the case of the expression tree shown above should be: (((a)+(b))*((()-(1)*((d)*(1))) Include in your answer a pseudo-code or definition of the data structure
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
