Created
July 13, 2017 14:57
-
-
Save vaidehijoshi/c70622e47743abcd0c986024c3da8e77 to your computer and use it in GitHub Desktop.
This file contains 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
function buildMaxHeap(array) { | |
var i; | |
i = array.length / 2 - 1; | |
i = Math.floor(i); | |
// Build a max heap out of | |
// all array elements passed in. | |
while (i >= 0) { | |
heapify(array, i, array.length); | |
i -= 1; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment