The sorting algorithm is undoubtedly the focus of learning the data structure. This article will give a summary of the sorting algorithm. The specific implementation is as follows: [cpp] # include <stdio. h> # include <stdlib. h> # include <time. h> # define N 1000000 int Array [N]; int Temp [N]; // 1. Bubble Sorting void BubbleSort (int a [], int n) {int I, j; int temp; int tag; for (I = n-1; I> 0; I --) {tag = 0; for (j = 0; j <I; j ++) if (a [j]> a [j + 1]) {temp = a [j]; a [j] = a [j + 1]; a [j + 1] = temp; tag = 1;} if (tag = 0) break;} // 2. Simple insertion sorting void SimpleInsertSort (int a [], int n) {int I, j, k; int temp; for (I = 1; I <n; I ++ ){ For (j = 0; j <I; j ++) if (a [j]> a [I]) {k = j; break ;} if (j = I) continue; temp = a [I]; for (j = I; j> k; j --) a [j] = a [J-1]; a [k] = temp ;}// 3. Hill sorting void ShellSort (int a [], int n, int d) {int h, I, j, k; int temp; do {d = d/3 + 1; for (h = 0; h <d; h ++) for (I = h + d; I <n; I + = d) {for (j = h; j <I; j + = d) if (a [j]> a [I]) {k = j; break;} if (j = I) continue; temp = a [I]; for (j = I; j> k; j-= d) a [j] = a [j-d]; a [k] = temp;} while (d> 1);} // 4. Simply select and sort void Simple SelectSort (int a [], int n) {int I, j, k; int temp; for (I = 0; I <n; I ++) {temp = a [I]; k = I; for (j = I + 1; j <n; j ++) if (a [j] <temp) {temp = a [j]; k = j;} if (k! = I) {temp = a [I]; a [I] = a [k]; a [k] = temp ;}}} // 5. Heap sorting void CreateHeap (int a [], int n) {int I, j; int temp; for (I = (n-2)/2; i> = 0; I --) {j = 2 * I + 1; while (j <n) {if (j + 1 <n & a [j + 1]> a [j]) j ++; if (a [(J-1) /2] <a [j]) {temp = a [(J-1)/2]; a [(J-1)/2] = a [j]; a [j] = temp;} else break; j = 2 * j + 1 ;}} void HeapAdjust (int a [], int n) {int I = 0; int j; int temp; while (I <n & 2 * I + 1 <n) {j = 2 * I + 1; if (j + 1 <n & a [j + 1]> a [j]) j ++; if (a [I] <a [j]) {temp = a [I]; a [I] = a [j]; a [j] = temp;} else break; I = j ;}} void HeapSort (int a [], int n) {int I; int temp; CreateHeap (a, n); for (I = n-1; I> 0; I --) {temp = a [I]; a [I] = a [0]; a [0] = temp; HeapAdjust (a, I );}} // 6. Fast sorting int partition (int a [], int low, int high) {int partition tkey = a [low]; while (low