Similar questions 4 more →
Stacks & Queues



Answer & solution
Answer: [10, 7, 5, 2], top = 2 (no official key was published)
Step through it (9 steps)
The prefix 5 2 * 3 4 + leaves [10,7]: 5*2=10 and 3+4=7 are two independent partial results. The next token 5 is an operand, so push it to obtain [10,7,5]. Push the next operand 2 to obtain [10,7,5,2]. Stop here: the following multiplication has not yet been read, so 5 and 2 must remain separate entries. The top is 2 and the bottom is 10.