int main(int argc, const char * argv[]){ int d[8]={4,3,6,2,1,5}; printlist(d,6); // Insert_Sort_Better(d,6); // printlist(d,6); // Insert_Shell_Sort(d,6); // printlist(d,6); // Bubble_Sort(d,6); // printlist(d,6); // Bubble_Sort2(d,6); // printlist(d,6); // MergeSort(d,6); // printlist(d,6); // Quick_Sort(d,0,5); // printlist(d,6); // Select_Sort(d,6); // printlist(d,6); MakeMinHeap(d,6); MinheapsortTodescendarray(d,6); printlist(d,6); }
int main() { int test[][10] = { {6,4,1,0,3,7,8,9,5,2}, {63,43,121,60,73,37,28,19,52,21}, {96,94,71,60,32,73,84,95,56,62}, {66,49,31,40,43,73,81,92,53,25}, {62,14,21,20,43,37,856,964,53,2}, {61,24,19,63,35,70,88,97,56,72}, {6,34,14,30,3,7,82,94,56,26} }; printf("#test bubble sort\n"); dump_sort(TEST_SIZE, bubble_sort, int_compare); printf("#test insert sort\n"); dump_sort(TEST_SIZE, insert_sort, int_compare); printf("#test select sort\n"); dump_sort(TEST_SIZE, select_sort, int_compare); printf("#test shell sort\n"); dump_sort(TEST_SIZE, shell_sort, int_compare); printf("#test merge sort\n"); dump_sort(TEST_SIZE, merge_sort, int_compare); printf("#test quick sort\n"); dump_sort(TEST_SIZE, quick_sort, int_compare); printf("#test min heap sort\n"); printf("source array:"); show_array(test[0], 10); MakeMinHeap((void**)test[0], 10, int_compare); MinHeapSort((void**)test[0], 10, int_compare); printf("dest array:"); show_array(test[0], 10); printf("\n"); }