int 与 int *
#include <iostream>
using namespace std;
int QKPass(int* , int , int); //若声明为 int QKPass(int, int, int); 会显示错误
void QKSort(int a[], int low, int high){
int pos;
if(low < high){
pos = QKPass(a, low, high);
QKSort(a, low, pos - 1);
QKSort(a, pos + 1, high);
}
}
int QKPass(int *a, int low, int high){
int x = a[low];
while(low < high){
while(low < high && a[high] >= x)
high--;
if(low < high){
a[low] = a[high];
low++;
}
while(low < high && a[low] <= x)
low++;
if(low < high){
a[high] = a[low];
high--;
}
}
a[low] = x;
return low;
}
int main(){
int n, a[100];
int i, j, t;
cin >> n;
for(i = 1; i <= n; i++)
cin >> a[i];
QKSort(a, 1, n);
for(i = 1; i <= n; i++)
cout << a[i] << " ";
return 0;
}
最新文章
- Linux用户配置sudo权限
- UIAccessibilityElement
- 在网页中弹出qq临时会话
- css3 动画 执行一次
- POJ 1743 Musical Theme (后缀数组,求最长不重叠重复子串)(转)
- http://jingyan.baidu.com/article/e4511cf33479812b855eaf67.html
- Android Broadcaset 简介
- JBPM6教程
- SOAPtest报错:error occurred during initialization of vm解决方法
- jenkins-ant-jmeter
- APIView源码分析
- CSS| 學習心得
- 腾讯云启动数据库进程,提示No such host is known
- db2 事务日志
- spark RDD底层原理
- 安装Windows Installer服务
- CKFinder 自定义文件路径扩展ConfigurationPathBuilder
- OpenCV---对象测量
- css背景颜色渐变
- 洛谷 P1103 书本整理(动规)
热门文章
- CI Weekly #17 | flow.ci 支持 Java 构建以及 Docker/DevOps 实践分享
- ios 视频/图片压缩
- css伪类的组合用法
- JS作用域相关知识(#精)
- [ext4]磁盘布局 - group分析
- 通过bootloader向内核传输启动参数
- JS基础——入门必备
- Transform java future into completable future 【将 future 转成 completable future】
- Ajaxfileupload 总结(包括插件处理json格式bug的解决方案)
- Python简要学习笔记