Skip to content

Latest commit

 

History

History

stacks_exercise

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

Stacks Exercise

For this exercise you must get the tests to pass.

Part I

  • Write a constructor function for a Stack

Implement the following methods on the Stack.prototype

push

This function adds the value to the beginning of the stack. This should be an O(1) operation and return the size of the stack.

pop

This function removes the value at the beginning of the stack. This should be an O(1) operation and return the value removed.

peek

This function returns the first value in the stack.

print

This function console.log's all the values in the stack.

Part II

  • Given a doubly linked list, implement a stack