In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
# include # includevoid insertSortForward (int orig [], int size); void insertSortBackward (int orig [], int size); void bubbleSort (int orig [], int size); void selectSort (int orig [], int size); void shellSort (int orig [], int size); void HeapSort (int orig [], int size); void QuickSort (int [], int, int); void swap (int *, int *); int Partition (int orig [], int left, int right); void BuildHeap (int orig [], int size) Void HeapAdjust (int [], int, int); int main () {int a [] = {1, 0, sizeof (a) / sizeof (a [0]); / bubbleSort (a, 7); / insertSortForward (a, 8); / / insertSortBackward (a, 8); / / selectSort (a, 8); / / shellSort (a, 8); / / HeapSort (a, 9); QuickSort (a, 0, sizeof (a) / sizeof (a [0])-1) I 0) {for (int j = k; j)
< size; j++) { t = orig[j]; i = j - k; while (i >= 0 & & t
< orig[i]) { orig[i+k] = orig[i]; orig[i] = t; i = i - k; } } k /= 2; if (k==0) { break; } } for (int i = 0; i < size; i++) printf("%d ", orig[i]); printf("\n"); }void HeapSort(int orig[], int size){ BuildHeap(orig, size); for (int i = 0; i < size; i++) printf("%d ", orig[i]); printf("\n"); while(size >0) {printf ("% d", orig [0]); orig [0] = orig [--size]; HeapAdjust (orig, 0Magne size);}} void QuickSort (int orig [], int left, int right) {if (left)
< right) { int point = Partition(orig, left, right); QuickSort(orig, left, point - 1); QuickSort(orig, point + 1, right); } }void swap(int *a, int*b) { int temp; temp = *a; *a = *b; *b = temp; }int Partition(int orig[], int left, int right){ int prikey = orig[right]; while (left orig[j + 1]) { int temp = 0; temp = orig[j]; orig[j] = orig[j + 1]; orig[j + 1] = temp; } } } for (int i = 0; i < size; i++) printf("%d ", orig[i]); printf("\n"); }void selectSort(int orig[], int size){ for (int i = 0; i < size; i++) { int min = orig[i]; int index = i; for (int j = i+1; j < size; j++) { if (min >Orig [j]) {min = orig [j]; index = j;}} orig [index] = orig [I]; orig [I] = min;} for (int I = 0; I < size; ionization +) printf ("% d", orig [I]); printf ("\ n");}
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.