11/*
2- * Build a max heap out of the array. A heap is a specialized tree like
3- * data structure that satisfies the heap property. The heap property
4- * for max heap is the following: "if P is a parent node of C, then the
5- * key (the value) of node P is greater than the key of node C"
6- * Source: https://en.wikipedia.org/wiki/Heap_(data_structure)
7- */
8-
2+ * Build a max heap out of the array. A heap is a specialized tree like
3+ * data structure that satisfies the heap property. The heap property
4+ * for max heap is the following: "if P is a parent node of C, then the
5+ * key (the value) of node P is greater than the key of node C"
6+ * Source: https://en.wikipedia.org/wiki/Heap_(data_structure)
7+ */
8+ /* eslint no-extend-native: ["off", { "exceptions": ["Object"] }] */
99Array . prototype . heapify = function ( index , heapSize ) {
1010 let largest = index
1111 const leftIndex = 2 * index + 1
@@ -29,10 +29,10 @@ Array.prototype.heapify = function (index, heapSize) {
2929}
3030
3131/*
32- * Heap sort sorts an array by building a heap from the array and
33- * utilizing the heap property.
34- * For more information see: https://en.wikipedia.org/wiki/Heapsort
35- */
32+ * Heap sort sorts an array by building a heap from the array and
33+ * utilizing the heap property.
34+ * For more information see: https://en.wikipedia.org/wiki/Heapsort
35+ */
3636function heapSort ( items ) {
3737 const length = items . length
3838
0 commit comments