当前位置:网站首页>2022.02.13 - NC002. sort
2022.02.13 - NC002. sort
2022-07-06 08:21:00 【A CAI continues to work hard】
List of articles
1. subject

2. Ideas
(1) Quick sort
- The most basic quick sort algorithm .
3. Code
public class Test {
public static void main(String[] args) {
}
}
class Solution {
public int[] MySort(int[] arr) {
sort(arr, 0, arr.length - 1);
return arr;
}
private void sort(int[] arr, int left, int right) {
if (left < right) {
int low = left;
int high = right;
int pivot = arr[low];
while (low < high) {
while (low < high && arr[high] >= pivot) {
high--;
}
arr[low] = arr[high];
while (low < high && arr[low] <= pivot) {
low++;
}
arr[high] = arr[low];
}
arr[low] = pivot;
sort(arr, left, low - 1);
sort(arr, low + 1, right);
}
}
}
边栏推荐
- Tidb backup and recovery introduction
- VMware virtualization cluster
- The State Economic Information Center "APEC industry +" Western Silicon Valley will invest 2trillion yuan in Chengdu Chongqing economic circle, which will surpass the observation of Shanghai | stable
- Restore backup data on S3 compatible storage with tidb lightning
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
- Epoll and IO multiplexing of redis
- Wireshark grabs packets to understand its word TCP segment
- All the ArrayList knowledge you want to know is here
- Mobile Test Engineer occupation yyds dry goods inventory
- Easy to use tcp-udp_ Debug tool download and use
猜你喜欢

IP lab, the first weekly recheck

Let the bullets fly for a while

hcip--mpls

All the ArrayList knowledge you want to know is here

C language - bit segment

IOT -- interpreting the four tier architecture of the Internet of things

The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower

Personalized online cloud database hybrid optimization system | SIGMOD 2022 selected papers interpretation

Wireshark grabs packets to understand its word TCP segment

ESP系列引脚說明圖匯總
随机推荐
NFT smart contract release, blind box, public offering technology practice -- jigsaw puzzle
Analysis of pointer and array written test questions
CISP-PTE实操练习讲解
649. Dota2 Senate
Golang DNS 随便写写
String to leading 0
Go learning notes (3) basic types and statements (2)
Hungry for 4 years + Ali for 2 years: some conclusions and Thoughts on the road of research and development
Leetcode skimming (5.29) hash table
图像融合--挑战、机遇与对策
Personalized online cloud database hybrid optimization system | SIGMOD 2022 selected papers interpretation
指针进阶---指针数组,数组指针
使用 TiDB Lightning 恢复 S3 兼容存储上的备份数据
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Uibehavior, a comprehensive exploration of ugui source code
Char to leading 0
"Friendship and righteousness" of the center for national economy and information technology: China's friendship wine - the "unparalleled loyalty and righteousness" of the solidarity group released th
2. File operation - write
[2022 广东省赛M] 拉格朗日插值 (多元函数极值 分治NTT)
Use dumping to back up tidb cluster data to S3 compatible storage