大橙子网站建设,新征程启航
为企业提供网站建设、域名注册、服务器等服务
示例:
我的排序代码
#includeint split(int a[], int low, int high)
{int tmp = a[low];
a[low] = 0;
while (low != high)
{if (a[low] == 0)
{ while (low != high)
{ if (a[high]< tmp)
{a[low] = a[high];
a[high] = 0;
low++;
break;
}
high--;
}
}
if (a[high] == 0)
{ while (low!=high)
{ if(a[low]>tmp)
{a[high] = a[low];
a[low] = 0;
high--;
break;
}
low++;
}
}
}
a[low] = tmp;
return low;
}
void quicksort(int a[], int low, int high)
{if (low >= high)
return;
int mid = split(a, low, high);
quicksort(a, low, mid - 1);
quicksort(a, mid + 1, high);
}
int main()
{int a[] = {9,16,47,82,4,66,12,3,25,51 };
quicksort(a, 0, 9);
for(int i=0;i<10;i++)
{printf("%d ", a[i]);
}
return 0;
}
你是否还在寻找稳定的海外服务器提供商?创新互联www.cdcxhl.cn海外机房具备T级流量清洗系统配攻击溯源,准确流量调度确保服务器高可用性,企业级服务器适合批量采购,新人活动首月15元起,快前往官网查看详情吧