diff --git a/冒泡、选择、插入排序.md b/冒泡、选择、插入排序.md index e39dbce..b35b878 100644 --- a/冒泡、选择、插入排序.md +++ b/冒泡、选择、插入排序.md @@ -38,6 +38,41 @@ int main(){ ### 选择排序 +```c +#include + +void selectSort(int *a, int n, int flag){ + int i, j, t; + for(i=0;i 0?a[i] > a[j]:a[i] < a[j]){ + t = a[i]; + a[i] = a[j]; + a[j] = t; + } + } + } +} + +void printArray(int *a, int n){ + int i; + for(i=0;i