Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need a working jsfiddle. The html and javascript must be separate . Assignment

ID: 3797396 • Letter: I

Question

I need a working jsfiddle. The html and javascript must be separate

.

Assignment

Implement a Stack in Javascript (you will turn in a link to your program in JSFiddle). Do not use an array as the stack or in the implementation of the stack. Repeat - You MUST implement the Stack (start with your linked list) without the use of an array..

You will build a Stack Computer from your stack. When a number is entered it goes onto the top of the stack. When an operation is entered, the previous 2 numbers are operated on by the operation and the result is pushed onto the top of the stack. This is how an RPN calculator.

For example

2 [enter] 2

5 [enter]   5 2

* [enter] * 5 2 -> collapses to 10

would leave at 10 at the top of the stack.

The program should use a simple input box, either a text field or prompt and display the contents of the Stack.

  Contents of Stack:

Information

Building A Stack is relatively easy if you have built a List. A Stack is nothing more complex with 2 extra functions added Push(_value) and Pop(). The Push function obviously needs an argument _value. The Pop function should always return the element on the top of the stack and at the same time removing it from the top of the stack.

Explanation / Answer

function evalrpn(s) { var st,tk,i,x,y,z s = s.replace(/^s*|s*$/g,'') s = s.length>0 ? s.split(/s+/) : [] st = [] for (i=0; i1 || '+-*/'.indexOf(tk)==-1 || st.length
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote