Question
Hint: C++ STACK Class Using Stack Datastructure not STL We are going to have a program that represents an expression in different formats such infix,
Hint: C++ STACK Class Using Stack Datastructure not STL
We are going to have a program that represents an expression in different formats such infix, prefix and postfix. The input expressions can be represented in infix, prefix or postfix expression. The infix expressions are fully parenthesised expression. The expressions contains identifiers as operands. An identifier is defined by a letter. Any sequence of spaces is considered as separator. Add and subtract operation have less priority than multiply, divide and modular.
The following are examples of different expressions:
+, - , * , / or % : operators
Infix expressions: ((A+ B ) * t ) Prefix expressions: + %xd-Yc Postfix expressions: x d % Y c - +
QUESTIONS:
A. Function named infix_2_prefix that given an infix expression returns the prefix expression of the input.
B. Function named prefix_2_infix that given a prefix expression returns the fully parenthesized parenthesised infix expression of the input.
C. Function named postfix_2_infix that given a postfix expression returns the fully parenthesized parenthesised infix expression of the input.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started