int main() { int array0[ARR_SIZE], array1[ARR_SIZE]; fill_arr(array0, DESC); duplicate_arr(array0, array1); sort_select(array0); sort_buble(array1); return 0; }
void sort_sort(const SortC * const self_p, NodeC * const node, const int length, const SortTypeU sortType) { switch (sortType) { case SELECT: sort_select(self_p, node, length); break; case BUBBLE: sort_bubble(self_p, node, length); break; default: COM_ERROR("Unknow sortType=%d", sortType); } }
void sort_setup(){ puts(""); puts(""); puts("introduce the sorting(排序) menu of the data structure and algorithms"); puts(""); sort_setup: puts("insert(插入排序) -------------------- 1"); puts("bubble(冒泡排序) -------------------- 2"); puts("select(选择排序) -------------------- 3"); puts("shell(希尔排序) --------------------- 4"); puts("quick(快速排序) --------------------- 5"); puts("heap(堆排序) ------------------------ 6"); puts(""); puts("please input the index you want to go[1-4]"); int index = 0; scanf("%d", &index); switch(index){ case 1: puts("go to insert sort(插入排序)"); before_sort(); sort_insert(); after_sort("insert sort(插入排序)"); break; case 2: puts("go to bubble sort(冒泡排序)"); before_sort(); sort_bubble(); after_sort("bubble sort(冒泡排序)"); break; case 3: puts("go to select sort(选择排序)"); before_sort(); sort_select(); after_sort("select sort(选择排序)"); break; case 4: // puts("go to select sort(希尔排序)"); // before_sort(); // sort_shell(); // after_sort("select sort(希尔排序)"); puts("shell sort is to be continued ..."); break; case 5: puts("go to select sort(快速排序)"); before_sort(); sort_quick(); after_sort("select sort(快速排序)"); break; case 6: // puts("go to select sort(堆排序)"); // before_sort(); // sort_heap(); // after_sort("select sort(堆排序)"); puts("heap sort is to be continued ..."); break; default: puts("incorrect index you chosen, please chose again"); goto sort_setup; break; } }