File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 11( function ( exports ) {
22
3+ 'use strict' ;
4+
35 function comparator ( a , b ) {
46 return a - b ;
57 }
1618 *
1719 * @private
1820 * @param {array } array Array
19- * @param {number } index Index of the element which palce in the max heap should be found.
21+ * @param {number } index Index of the element which palce in
22+ * the max heap should be found.
2023 */
2124 function heapify ( array , index , heapSize , cmp ) {
2225 var left = 2 * index + 1 ,
2326 right = 2 * index + 2 ,
2427 largest = index ;
2528
26- if ( left < heapSize && cmp ( array [ left ] , array [ index ] ) > 0 )
29+ if ( left < heapSize && cmp ( array [ left ] , array [ index ] ) > 0 ) {
2730 largest = left ;
31+ }
2832
29- if ( right < heapSize && cmp ( array [ right ] , array [ largest ] ) > 0 )
33+ if ( right < heapSize && cmp ( array [ right ] , array [ largest ] ) > 0 ) {
3034 largest = right ;
35+ }
3136
3237 if ( largest !== index ) {
3338 var temp = array [ index ] ;
You can’t perform that action at this time.
0 commit comments