Question: 3. A Full Binary Tree is used to represent an Arithmetic Expression with operators times, add, and subtract as illustrated below: infix form: ((3*5) *4)

3. A Full Binary Tree is used to represent an Arithmetic Expression with operators times, add, and subtract as illustrated below: infix form: ((3*5) *4) (2-(16+5)) 4 2+ 16 5 The three arithmetic operators each have two arguments. Nodes in this structure have the following class variables boolean internalNode; // true for internal nodes, false for leaf nodes char operator; int value; Node leftChild; Node rightChild; // for internal nodes, {'+', -,, *,} // for leaf nodes Write a short, efficient, recursive function, String toInfix(Node x), that is passed a reference to the root node of a valid Arithmetic Expression Tree, as described above, and returns a String containing the equivalent expression in standard infix form, as illustrated to the right of the tree
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
