Infix representation of given equation-Quiz question asked in coding rounds

Placewit
1 min readJul 5, 2022

Problem Statement:

What is the postfix representation of the given infix expression: (A + B) * C — D * E / F ?

  1. AB+C^ * D E^ * F -
  2. AB^ * C+D E^ * F/.
  3. AB + C-D E^ * F/^ *
  4. AB+C^ * D E^ * F/

Correct answer:

Option 4: AB+C^ * DE^ * F/

0 has highest precedence

*and / has same precedence while + and — has same precedence

(and/) and higher precedence than (+-)

Associativity is left to right.

(A+B) *C-D *E/FAB+*C-D*E/FAB+C*-D*E/FAB+C*-DE/FAB+C*-DE* F/AB+C* DE* F/

Thanks for Reading

Placewit grows the best engineers by providing an interactive classroom experience and by helping them develop their skills and get placed in amazing companies.

Learn more at Placewit. Follow us on Instagram and Facebook for daily learning.

--

--