n log n guarantee heapsort arranges the array in a max-heap then sorts it ascendingly rearranges the array in ascending order , using the natural order . concode_field_sep PlaceHolder placeHolder concode_field_sep void sink concode_elem_sep void exch concode_elem_sep void show concode_elem_sep void main concode_elem_sep boolean less concode_elem_sep boolean less concode_elem_sep boolean isSorted
void function ( Comparable [ ] arg0 ) { int loc0 = arg0 . length ; for ( int loc1 = loc0 / 2 ; loc1 >= 1 ; loc1 -- ) sink ( arg0 , loc1 , loc0 ) ; while ( loc0 > 1 ) { exch ( arg0 , 1 , loc0 -- ) ; sink ( arg0 , 1 , loc0 ) ; } }