Change the index of the element which was at position 0. Swap the element basically .
int element = arr . get ( best_index ) ; h . put ( element , initial_index ) ; int temp = arr . get ( best_index ) ; arr . set ( best_index , arr . get ( initial_index ) ) ; arr . set ( initial_index , temp ) ;