edited by
3,640 views
2 votes
2 votes

Consider the following expression with infix notation

A * B - (C + D) * (E / 5) ^ F 

What is the maximum height of the operator stack during conversion from infix to postfix ?

a) 3

b) 4

c) 5

d) 6

edited by

3 Answers

Best answer
4 votes
4 votes

This normal conversion of infix to post fix operator stack is nothing just it contains operators thats it

see this here in stack at max we have 4 elements so stack size is 4

selected by
0 votes
0 votes

Stack grows only up to 4 sizes but in the image, it is shown that stack grows for 5 sizes but first left parenthesis is by default added so total size is 4.

–3 votes
–3 votes
when   /  is reached the operator stack will be  - * ( /  so max height =4

Related questions

1 votes
1 votes
2 answers
1
smartmeet asked Jan 18, 2017
1,005 views
What we can do if the unary operator comes in infix notation while converting it into postfix/prefix notations? For example, this $a = -b+c*d/e+f↑g↑h-i*j$
2 votes
2 votes
2 answers
2
jatin khachane 1 asked Dec 1, 2018
1,227 views
My doubt : What should we consider ^ operator as Bitwise XOR ? or Exponentiation
2 votes
2 votes
0 answers
3
2 votes
2 votes
2 answers
4
Amit puri asked Sep 29, 2016
2,696 views
Convert the infix to postfix and prefix expression1) log3! ^log4 *log log 6/7*4!2)log3!^sin 2*cos 3