堆排序算法

#include <stdio.h> void adjust_array(int array[], int length, int start) { int tmp; for (int i=start; i<=length/2-1; ) { if (array[2*i+1] > array[i] || 2*i+2 < length \ && array[2*i+2] > array[i]) { tmp = array[i]; if (2*i + 2 < length && array[2*i+2] > array[2*i+1]) { array[i] = array[2*i+2]; array[2*i+2] = tmp; i = 2*i + 2; } else { array[i] = array[2*i+1]; array[2*i+1] = tmp; i = 2*i +…