Give the infix expression of the following prefix expressions.
(A) * – + A B C D
(B) + – a * B C D
Algorithm for Prefix to Infix:
A)
after first 4 step:
Prefix: *–+
Infix: DCBA
next:
Prefix: *–
Infix: DC(A+B)
Prefix: *
Infix: DC(A+B)-
Prefix:
Infix: DC(-*(A+B))
B)
Prefix: +–a*BC
Infix: D
Prefix: +–a*B
Infix: DC
Prefix: +–a*
Infix: DCB
Prefix: +–a
Infix: D(B*C)
Prefix: +–
Infix: D(B*C)a
Prefix: +
Infix: D(B*C)a-
Prefix:
Infix: D(B*C)(-+a)
Comments
Leave a comment