PRASHNIKAप्रश्निका
‹ Back to the paper

Convert the following infix notation to postfix form:

Computer Science20182 marksOne word
Convert the following infix notation to postfix form: $A + ( B - C * ( D / E ) * F )$

Answer

Answer

AI
$A + ( B - C * ( D / E ) * F )$ Converting using the standard operator-precedence (stack-based) algorithm (verified by running the conversion in code): $D/E \to DE/$ $C*(D/E) \to C\,DE/\,* = CDE/*$ $C*(D/E)*F \to CDE/*\,F\,* = CDE/*F*$ $B - [C*(D/E)*F] \to B\,CDE/*F*\,- = BCDE/*F*-$ $A + [B-C*(D/E)*F] \to A\,BCDE/*F*-\,+$ Postfix: $A\;B\;C\;D\;E\;/\;*\;F\;*\;-\;+$
Data structures

From ISC 2018 Computer Science Paper 1, question 2(c).