Evaluate the post fixed expression • Initialize an empty

QUESTION

 Evaluate the post fixed expression• Initialize an empty stack.While there are more symbols in the postfix string{ If the token is an operand, push it onto the stack. If the token is an operator{o Pop the two topmost values from the stack, and store them in the order t1, the topmost, and t2 the second value.o Calculate the partial result in the following order t2 operator t1o Push the result of this calculation onto the stack.NOTE: If the stack does not have two operands, a malformed postfix expression has occurred, and evaluation should be terminated.}}• When the end of the input string is encountered, the result of the expression is popped from the stack.NOTE: If the stack is empty or if it has more than one operand remaining, the result is unreliable.Extend this algorithm to include square brackets and curly braces. For example, expressions of the following kind should be considered:• 2 + { 2 * ( 10 – 4 ) / [ { 4 * 2 / ( 3 + 4) } + 2 ] – 9 }• 2 + } 2 * ( 10 – 4 ) / [ { 4 * 2 / ( 3 + 4) } + 2 ] – 9 {Implement the above two algorithms for the following binary operators: addition +, subtraction -, multiplication *, division /, and modulus operation %. All operations are integer operations. To keep things simple, place at least one blank space between each token in the input string.

 

ANSWER:

REQUEST HELP FROM A TUTOR

Expert paper writers are just a few clicks away

Place an order in 3 easy steps. Takes less than 5 mins.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00