562 views
1 1 vote
Consider the expression [(A + B) * C – D] + [(E / F) / (G + H)]
Convert the above infix expression to postfix

For the given infix expression, how many number of activation records used in the stack?

1 Answer

Best answer
3 3 votes
AB + C * D – EF / GH + / +

just start from left ..we need operator stack...whenever u come across a operator and if stack is empty just push...and if not empty just check that more precendence operator can sit on lighter one...else pop...for parenthesis...when ( or [ comes, push it and when u see ) or ] pop till u see the their left ones...

 

While converting the expression from infix to postfix, the stack has used the activation records for operators in each record one operator is there  maximum of 5 records has been used in the conversion
• selected by
Position:
Show:

No related questions found