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

Convert the following infix notation to postfix form.

Computer Science20232 marksOne word
Convert the following infix notation to postfix form. $( P / Q - R ) * ( S + T )$

Answer

Answer

AI
$(P/Q-R)*(S+T)$ Converting $(P/Q-R)$: push $($, output $P$, push $/$, output $Q$ (so far $PQ$), on seeing $-$ pop $/$ to output ($PQ/$) then push $-$, output $R$ ($PQ/R$), on $)$ pop $-$ ($PQ/R-$). Converting $(S+T)$: output $ST+$. Combine with $*$: $PQ/R- \;\; ST+ \;\; *$ Postfix: $PQ/R-ST+*$
Data structures

From ISC 2023 Specimen Computer Science Paper 1, question 2(i).