摘要: void random(int a,int b) { int t; t=(rand()%(b-a+1))+a; return t; } //该函数用于随机取a~b的任意数 rand()可以生成0~32767(windows),0~2147483647(Linux) 头文件为 #include<cst 阅读全文
posted @ 2022-04-16 22:15 半喜 阅读(96) 评论(0) 推荐(0)
摘要: int partition(int p,int r) { int low,high; low=p; high=r; int temp; temp=a[low]; while(low<high) { while(low<high&&a[high]>=temp) //从后面扫描 high--; a[lo 阅读全文
posted @ 2022-04-16 21:15 半喜 阅读(107) 评论(0) 推荐(0)