[实验内容]
1、直接插入排序2、快速排序3、堆排序(要求了解原理) 【实验测试数据】 输入数据:{49,38,65,97,76,13,27,49}
#include#define M 8typedef struct{ int key; int other_data;}RecordType;void InsSort(RecordType r[], int length);void QKSort(RecordType r[],int low, int high );int QKPass(RecordType r[],int left,int right);void InsSort(RecordType r[], int length){ int i,j; for (i=2; i<=length; i++) { r[0]=r[i]; j=i-1; while (r[0].key< r[j].key ) { r[j+1]= r[j]; j=j-1; } r[j+1]=r[0]; }}void QKSort(RecordType r[],int low, int high ){ int pos; if (low =x.key ) high--; if ( low