1.0 KiB
1.0 KiB
Task
I want you to write a simple calculator to evaluate arithmetic expressions. Solve your problem step by step with C++. Please consider the precedence of operators as well.
It includes two parts:
- In the first part, you need to convert the input to a postfix expression.
- In the second part, you need to evaluate the postfix expression that you get in the first part.
- You need to implement your algorithms using c++.
- You also need to write comment inside the code explaining the following items.
Part 1: Convert an expression to postfix expression using stack in STL
- how to read and store the input?
- pseudo code of the algorithm
- data structures used in the algorithm
- time complexity
- space complexity
- how to store the postfix expression?
Part 2: Use stack of STL to evaluate a postfix expression
- how to read the postfix expression
- pseudo code of the algorithm
- data structures used in the algorithm
- time complexity
- space complexity
- how to output the final result?