r0otnode
India
That thou art. Think.

That thou art. Think.

当前离线
截图展柜
Kingdom Come: Deliverance II
2 2
最新动态
总时数 0 小时
最后运行日期:2 月 22 日
成就进度   0 / 59
总时数 0.1 小时
最后运行日期:2 月 22 日
500 点经验值
成就进度   0 / 13
总时数 0.2 小时
最后运行日期:2 月 22 日
成就进度   0 / 15
留言
2010 Dodge Charger 2025 年 11 月 2 日 下午 10:51 
have some faith arthur
Sickening Consistency 2025 年 11 月 2 日 上午 6:39 
Funny teammate
r0otnode 2025 年 5 月 24 日 下午 9:25 
int partition(std::vector<int>& arr, int low, int high) {
int pivot = arr[high];
int i = (low - 1);

for (int j = low; j <= high - 1; j++) {
if (arr[j] < pivot) {
i++;
std::swap(arr , arr[j]);
}
}
std::swap(arr , arr[high]);
return (i + 1);
}

void quickSort(std::vector<int>& arr, int low, int high) {
if (low < high) {
int pi = partition(arr, low, high);

quickSort(arr, low, pi - 1);
quickSort(arr, pi + 1, high);
}
}

int main() {
std::vector<int> data = {10, 7, 8, 9, 1, 5};
int n = data.size();
quickSort(data, 0, n - 1);
for (int i = 0; i < n; i++)
std::cout << data << " ";
std::cout << std::endl;
return 0;
}