Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

readme.md

Binary Heaps Exercise

For this exercise you must get the tests to pass.

Part I

Given the following constructor function

function MaxBinaryHeap(val){
    this.values = [];
}

insert

Implement the insert function on the MaxBinaryHeap.prototype: This function should insert a node in a binary heap. Make sure to re-order the heap after insertion if necessary

Part II

Given an array of numbers, implement a function called maxHeapify which converts an array of numbers into a max-heap

Bonus

Implement the remove function on the MaxBinaryHeap.prototype This function should remove the root node in a binary heap. Make sure to re-order the heap after removal if necessary