2 Star 45 Fork 11

imxtx/algorithms

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
selection.c 382 Bytes
一键复制 编辑 原始数据 按行查看 历史
imxtx 提交于 4年前 . add source code
#include "../utils.h"
void selection_sort(int arr[], int len)
{
int i, j, min;
for (i = 0; i < len; i++)
{
min = i;
for (j = i + 1; j < len; j++)
{
if (arr[j] < arr[min])
min = j;
}
swap(&arr[min], &arr[i]);
}
}
int main(int argc, char const *argv[])
{
test(&selection_sort);
return 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/imxtx/algorithms.git
git@gitee.com:imxtx/algorithms.git
imxtx
algorithms
algorithms
main

搜索帮助