TCS
Company
Programming
Puzzles
Find Prefix and Postfix for the below Infix problem statement:
Infix Expression: 11 + 20/5* (20 - 15)^6^5
A. Prefix Expression: 11 20 15 20 5 - ^^*6 5/+
Postfix Expression: +20 / 11 * 5 - 20 ^^15 6 5
B. Prefix Expression: 11 20 5 20 15 - 6 5^^*/+
Postfix Expression: +11 / 20 * 5^^ - 20 15 6 5
C. Prefix Expression: 11 20 5 20 15 - ^^*/+6 5
Postfix Expression: +11 /^^-20 * 5 20 15 6 5
D. Prefix Expression: +11/20 * 5^^ - 20 15 6 5
Postfix Expression: 11 20 5 20 15 - 6 5^^*/+
Read Solution (Total 7)
-
- Pls tell this answer
- 3 years agoHelpfull: Yes(1) No(2)
- Prefix :
11 + 20 / 5 * - 20 15 ^ 6 ^ 5
11 + 20 / 5 * ^ - 20 15 6 ^ 5
11 + 20 / 5 * ^ ^ - 20 15 6 5
11 + 20 / * 5 ^ ^ - 20 15 6 5
11 + / 20 * 5 ^ ^ - 20 15 6 5
+ 11 / 20 * 5 ^ ^ - 20 15 6 5
Postfix:
11 + 20 / 5 * 20 15 - ^ 6 ^ 5
11 + 20 / 5 * 20 15 - ^ 6 5 ^
11 + 20 / 5 * 20 15 - 6 5 ^ ^
11 + 20 / 5 20 15 - 6 5 ^ ^ *
11 + 20 5 20 15 - 6 5 ^ ^ * /
11 20 5 20 15 - 6 5 ^ ^ * / +
So, the answer is option D. - 3 years agoHelpfull: Yes(1) No(1)
- correct ans is option :D. Prefix Expression: +11/20 * 5^^ - 20 15 6 5
Postfix Expression: 11 20 5 20 15 - 6 5^^*/+ - 3 years agoHelpfull: Yes(0) No(1)
- I think based on order of precedence is considered ^^>*>/>+- prefix
Postfix- ->/>*>^^ - 3 years agoHelpfull: Yes(0) No(1)
- https://brainly.in/question/39825991
here is the solution - 2 years agoHelpfull: Yes(0) No(1)
- Step 1: Reverse the infix expression i.e A+B*C can become C*B+A. Note while reversing every '(' will become ')' and every ')' becomes '('.
Step 2: Obtain the “nearly” postfix expression of the changed expression i.e CB*A+.
Step 3: Reverse the postfix expression.
Steps for infix to postfix conversion:
Step 1: Scan the given Infix expression from the left to right direction.
Step 2: Initialize an empty stack.
Step 3: If the incoming character is an operand, add it to the postfix string.
Step 4: If the incoming character is an operator and push the character to stack if the stack is empty.
∴ According to above rule,
Infix Expression: 11 + 20/5* ( 20 - 15 )^6^5
Postfix Expression: 11 20 5 / 20 15 - 6 5 ^ ^ * +
Prefix Expression: +11 / 20*5^ - 20 15 ^65 - 6 Months agoHelpfull: Yes(0) No(0)
- d
Postfix:
11 + 20 / 5 * 20 15 - ^ 6 ^ 5
11 + 20 / 5 * 20 15 - ^ 6 5 ^
11 + 20 / 5 * 20 15 - 6 5 ^ ^
11 + 20 / 5 20 15 - 6 5 ^ ^ *
11 + 20 5 20 15 - 6 5 ^ ^ * /
11 20 5 20 15 - 6 5 ^ ^ * / + - 3 Months agoHelpfull: Yes(0) No(0)
TCS Other Question