5,792 views
0 0 votes

2 Answers

2 2 votes

Given infix expression are$:2 + 3 - ( 6 * 7 ) $

now convert infix to postfix expression using operator stack, we get postfix expression$: 2 3 + 6 7 * - $ [Because, if associativity not given we take $'+' $ are left associative]

now postfix expression$: 2 3 + 6 7 * - $

Scan entire string from left to right, when any operator come, pop top two elements and perform an operation (let say result = pop2$+$po1) and then push back result into the stack. Repeat this step until string scanning is over. 

So,i got $(3)$ are stack configuration.

and if we take $'+'$  is right associative,then postfix expression are$: 2 3 6 7 * - + $  

So, I got $(2)$ are stack configuration.

 

• edited by
0 0 votes
I think it must be not possible stack configuration

 by taking * as high precedence , + and - have same precedence

now there are two cases it can be left as well as right so applying as left associative we get option 1 and 3 as we apply right associative we also get option 2

So option 4 must be wrong
Position:
Show:

Related questions

0 0 votes
0 0 answers
1.4k
1.4k views
Mk Utkarsh asked Oct 20, 2018
1,365 views
Please convert it to postfix by using stack and explain in detailvoid (*bsd_signal(int sig, void (*func)(int)))(int);
0 0 votes
1 1 answer
3.4k
3.4k views
Ananya Jaiswal 1 asked Dec 12, 2017
3,402 views
Result for evaluating the following post fix105+606/*8-I'm confused whether it is correct postfix expression.
2 2 votes
1 answers 1 answer
6.7k
6.7k views
Himanshu Goyal asked Jul 14, 2017
6,665 views
How is ans 15 for this question Please can anybody solve this
1 1 vote
1 1 answer
3.6k
3.6k views
JaiKumar Guwalani asked May 6, 2018
3,628 views
What is time and space complexity to evaluate postfix expression ?