In assignment 1 you had used the data structure called Stack toevaluate arithmetic expressions by first converting the giveninfixed expressions to postfixed expressions, and then evaluatedthe post fixed expression.
Repeat the exercise for this assignment (assignment 2) by usingthe data structure called Binary Trees. Your output must displaythe original expression, the postfixed expression representing theBinary tree, and the evaluated result.
Please bear in mind that a given expression could result in oneof the following:
• Mismatch parentheses
• Too many operators, or too many operands in which case theexpression would not have been written properly in the firstplace
• The result is assumed to be correct.
previous assigment :
import java.util.*;class Arithmetic{ public String exp,postfixexp; public Arithmetic(String exp){ this.exp=exp; this.postfixexp=\"\"; } //___________________________isBalance()__________________ public boolean isBalance(){ Stack stk = new Stack(); int i; for(i=0;i stack = new Stack<>(); for (int i = 0; i stack=new Stack<>(); for(int i=0;i