2 Star 3 Fork 0

thor / unisim

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
test3.c 716 Bytes
一键复制 编辑 原始数据 按行查看 历史
thor 提交于 2013-11-25 15:17 . max-test pass
#include "stdlib.h"
int array[] = {2, 1, 5, 4, 3, 6};
void print_value()
{
int i;
for (i = 0; i < 6; i++)
sys_putint(array[i]);
sys_putint(12345);
}
int pivotLoc(int *arr, int bt, int ed)
{
int stand;
stand = arr[bt];
while (bt < ed) {
while (bt < ed && arr[ed] >= stand) ed --;
if (bt < ed) arr[bt ++] = arr[ed];
while (bt < ed && arr[bt] <= stand) bt ++;
if (bt < ed) arr[ed --] = arr[bt];
}
arr[bt] = stand;
return bt;
}
void quickSort(int *arr, int bt, int ed)
{
print_value();
int pivot;
if (bt < ed) {
pivot = pivotLoc(arr, bt, ed);
quickSort(arr, bt, pivot - 1);
quickSort(arr, pivot + 1, ed);
}
}
int main()
{
int i;
quickSort(array, 0, 6);
return array[0];
}
C
1
https://gitee.com/thor/unisim.git
git@gitee.com:thor/unisim.git
thor
unisim
unisim
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891