

Infix expression: The expression of the form ‘a operator b’. When an operator is in-between every pair of operands.
The expression tree is a binary tree in which each internal node corresponds to the operator and each leaf node corresponds to the operand so for example expression tree for 5 * ( 6 - 3 ) / 2 - 8 would be:

The first line of input contains an integer 'T' representing the number of test cases.
The first line of each test case contains a string S representing infix expression.
For each test case, return the binary expression tree, whose inorder traversal is the same as 'S'.
Return -1 instead of NULL.
The output for each test case is printed in a separate line.
You do not need to print anything, it has already been taken care of. Just implement the given function.
1 <= T <= 5
1 <= N <= 5000
Operands are only numbers between 0 and 9 (included).
It is guaranteed that ‘S’ is a valid infix expression.
Time limit: 1 sec
The idea is that we will use two stacks, one for operators and the other for nodes but before all this, we need to first set the priority of each operator. We can use a map to set priority.
After setting the priority we will iterate through all characters of the given string ‘STR’ and we will have 4 cases.
After this if stack size is still greater than 1 then we will make new nodes using operator and node stack till get size = 1 in the node stack.
Algorithm:
map<char,int> priority;
Set priority of ‘(‘ = 1, ‘-’ = 2, ‘+’ = 2, ’*’ =3 , ‘/’ = 3
stack<char> operators;
stack<binarytreenode> tree
foreach(char c of s){
Check for all above cases one by one.
}
while(node.size > 1)
{
makeNode(operator, tree).
}
return tree.top().