Write the infix expression for this Reverse Polish Notation (RPN) expression: 52 - 5 4 + * 9 /
- (a)(i)Write the infix expression for this Reverse Polish Notation (RPN) expression: 52 - 5 4 + * 9 /[2]
- (a)(ii)Show how the contents of the following stack will change as the RPN expression in part (a)(i) is evaluated.[4]
- (b)Explain how a stack can be used to evaluate RPN expressions.[3]
Mark scheme
Marking points from the official mark scheme (Oct/Nov 2023). The mark or mark type is shown in brackets.
- [1] (5 – 2)
- [1] * (5 + 4) / 9
- [2] Final correct expression (5 – 2) * (5 + 4) / 9
- [1] One mark per ring (Max 4) First circle: 3 Second circle: 9 Third circle: 27 Fourth circle: 3
- [1] MP1 Evaluate the RPN expression from left to right
- [1] MP2 Push each element of the RPN expression onto the stack in order until an operator is reached
- [1] MP3 Pop the last two elements from the stack and apply the operator
- [1] MP4 Push the result of the operation onto the stack
- [1] MP5 Repeat the process until the whole expression is evaluated.
Write your answer and get it marked
On Oracle Prep you can write or photograph your own answer and have it marked by AI against this mark scheme, with feedback on what you missed.
Sign up free →