C++
杰出的小茄子
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
C++快速排序代码简洁实现,一看就懂,不需要讲解
#include "iostream" #include "vector" using namespace std; void quick_sort(vector<int>& s, int l, int r){ int mark(s[l]),l_y(l),r_y(r);//mark是参考对比点,l_y与r_y用于记录原起始位置 if(l>=r) return; while(l<r) { while(l<r&&am原创 2021-03-04 10:30:11 · 666 阅读 · 1 评论 -
C++ sort快速排序,并返回原索引
标题直接看总代码即可 引用头文件 #include<vector> #include<algorithm> #include<iostream> using namespace std; 定义初始化一个数组 vector <int> temp = {1,3,2,4}; 定义排序用的结构体与数组,记录原索引与value typedef struct { int index; int value; }sort_st; vector <so原创 2020-08-28 15:50:40 · 6240 阅读 · 1 评论
分享