Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Utilize the doubly linked list code shown below as a base for the stack * * Please post the HTML and Javascript - must be
Utilize the doubly linked list code shown below as a base for the stackPlease post the HTML and Javascript must be able to run in JS Fiddle jsfiddlenet when using jsfiddle make sure to select no wrap in body" or no wrap in head" under the javascript settingsMust be built using a list, not an array 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 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 enterenterenter collapses to would leave at 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. let list null;
function createList
let value document.getElementByIdLinkNamevalue;
list new Listvalue;
document.getElementByIddemoinnerHTML list.print;
function addNode
let value document.getElementByIdLinkNamevalue;
list.addNodevaluelist.last;
document.getElementByIddemoinnerHTML list.print;
function Nodevalue, last
this.value value;
this.last last;
this.next null;
return this;
Node.prototype.asString function
return Node Value: this.value ;
function Listvalue
this.length ;
this.head new Nodevalue, null;
this.last this.head;
List.prototype.addNode function value,last
let node new Nodevalue, last;
if thislength
this.last.next node;
node.last this.last;
this.last node;
else
this.head node;
this.last node;
this.length;
List.prototype.print function
let s ;
let n this.head;
while n null
s nasString;
n nnext;
return s;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started