Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Latest commit

 

History

History
46 lines (37 loc) · 1.62 KB

File metadata and controls

46 lines (37 loc) · 1.62 KB

8.2 插入排序

直接插入排序 Insert Sort

代码实现

void InsertSort(int A[], int n) {
int i, j;
for (i = 2; i <= n; i++)
    if (A[i] < A[i - 1]) {
        A[0] = A[i];
        for (j = i - 1; A[0] < A[j]; j--)
            A[j + 1] = A[j];
        A[j + 1] = A[0];
    }
}

折半插入排序

代码实现 TODO

希尔排序 Shell Sort (缩小增量排序)

  • 代码 TODO