代码拉取完成,页面将自动刷新
#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];
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。