Question: Reverse Polish Notation banks on the idea that the operators go at the end of its operands thus the term Reverse Polish Notation. You will

Reverse Polish Notation banks on the idea that the operators go at the end of its operands thus the term "Reverse Polish Notation." You will be using a Stack data structure where data and or items are added pushed onto the top of the stack. A stack is a LIFO.

Take the example: The infix expression "5 + ((1 + 2) x 4) - 3" can be written down like this in RPN:

5 1 2 + 4 x + 3 -

Rules: 1) Push values on to the top of the stack until you read Operator (+, -, x, /)

2) Pop last two values off stack once you read an operator and do operation then push result onto stack: Go to Step 1

Implement your solution to this problem in only one of three different ways (NOT all three) choose one: Vector, Linked List or Array

C++ Design and implement the RPN calculator in one of the three different ways by using either a:

1) Vector -- use the STL library to create the RPN calculator

2) Linked List -- with the Linked List source code presented in class and implement the RPN calculator using the finished Linked List

3) Array -- use a static array of 10 - 15 elements to implement the RPN calculator

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!