MENU
Question -

Convert the expression ((x * 3 + y * 3 + z * 3) / (x + y + z)) into postfix expression. Show the content of the stack during the conversion.



Answer -

Given expression : ((x * 3 + y * 3 + z * 3) / (x + y + z))
((x * 3 + y * 3 + z * 3) / (x + y + z))

Symbol

Scanned

Stack

Expression

(

(

X

*

(

((

((

((*

X

X

3

+

y

X-

3

+

z

X-

3

)

/

(

X

+

y

+

Z

)

)

((*

((* +

((* +

((* + *

((* + *

((* + * +

((* + * +

((* + * + *

((* + * + *

(

(/

(/(

(/(

(/(+

(/(+

(/(+ +

(/

x3

x3

x3y

x3y

x3y3

x3y3

x3y3z

x3y3z

x3y3z3

x3y3z3 * + * + *

x3y3z3 * + * + *

x3y3z3* + * + *

x3y3z3 * + * + * x

x3y3z3 * + * + * x       •

x3y3z3 * + * + * x y

x3y3z3 * + * + * x y

x3y3z3 * + * + * xyz

x3y3z3 * + * + * xyz + +

x3y3z3 * + * + * xyz + +/

\Postfix expression is: x3y3z3 * + * + * xyz ++/

 

Comment(S)

Show all Coment

Leave a Comment

Free - Previous Years Question Papers
Any questions? Ask us!
×