Skip to content

Instantly share code, notes, and snippets.

@RyanCCollins
Created April 26, 2017 01:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RyanCCollins/5df46f5d3aa282ab2bbfecc6610a674c to your computer and use it in GitHub Desktop.
Save RyanCCollins/5df46f5d3aa282ab2bbfecc6610a674c to your computer and use it in GitHub Desktop.
Algorithms
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