I know this is an old submission, but here goes
This is the correct form. You can easily check it by iterating through the postfix yourself and converting it back to infix, like this, starting with an empty stack.
A
is the first element in the array, and it is a number, so push it onto the stack. The same holds true for B and
C. Therefore your stack is now
A,B,C`.
The next token is an operator(*
) and it takes two operands. Therefore, pop the top two operands from the stack, or B
and C
. Combine the two, separated by the operator, and push it onto the stack. To simplify the algorithm, just put parentheses around everything. Your stack is now A,(B*C)
.
Your next token is another binary operator(+
). Repeat the same process as above, and you get your stack as (A+(B*C))
.
Repeat the process for the rest of it, and you'll get an expression equivalent to (A+B*C)/(D-E*F)