Created
April 26, 2017 01:16
-
-
Save RyanCCollins/5df46f5d3aa282ab2bbfecc6610a674c to your computer and use it in GitHub Desktop.
Algorithms
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Stack { | |
constructor() { | |
this.storage = []; | |
} | |
push(val) { | |
this.storage.push(val); | |
} | |
pop() { | |
this.storage.pop(); | |
} | |
size() { | |
return this.storage.length; | |
} | |
log() { | |
console.log(this.storage); | |
} | |
} | |
class Queue { | |
constructor() { | |
this.storage = []; | |
} | |
push(val) { | |
this.storage.push(val); | |
} | |
pop() { | |
this.storage = this.storage.slice(1); | |
} | |
log() { | |
console.log(this.storage); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment