Skip to content

Instantly share code, notes, and snippets.

View brianxautumn's full-sized avatar

Brian brianxautumn

  • San Francisco
  • 20:02 (UTC -07:00)
View GitHub Profile
class Stack{
constructor(length){
this.data = new Array(length);
this.pointer = 0;
}
push(value){
if(this.pointer === this.data.length){
throw "Overflow"
class Queue{
constructor(){
this.stack1 = [];
this.stack2 = [];
}
enqueue(data){
while(this.stack1.length){
var temp = this.stack1.pop();
//children are 2n + 1, 2
//parents are floor((n-1)/2)
class MaxHeap {
constructor() {
this.data = new Array(10);
this.size = 0;
}
insert(value) {