swap arr whenever index is swapped
swap ( arr [ largest ] , arr [ i ] ) ; swap ( index [ largest ] , index [ i ] ) ; heapify ( arr , index , largest ) ; } } void heapSort ( int arr [ ] , int index [ ] , int n ) {