File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 1818 * @param {function } cmp Comparison function.
1919 */
2020 function heapify ( array , index , heapSize , cmp ) {
21+ console . log ( "heapifying" ) ;
22+
2123 var left = 2 * index + 1 ;
2224 var right = 2 * index + 2 ;
2325 var largest = index ;
3638 array [ largest ] = temp ;
3739 heapify ( array , largest , heapSize , cmp ) ;
3840 }
41+
42+ console . log ( array ) ;
43+
44+
3945 }
4046
4147 /**
5056 for ( var i = Math . floor ( array . length / 2 ) ; i >= 0 ; i -= 1 ) {
5157 heapify ( array , i , array . length , cmp ) ;
5258 }
59+
5360 return array ;
5461 }
5562
8491 size -= 1 ;
8592 heapify ( array , 0 , size , cmp ) ;
8693 }
94+ console . log ( array ) ;
8795 return array ;
8896 } ;
8997 } ( ) ) ;
9098
9199 exports . heapSort = heapSort ;
92100
93101} ) ( typeof window === 'undefined' ? module . exports : window ) ;
102+
103+
104+
105+
106+
107+
You can’t perform that action at this time.
0 commit comments