-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuick Sort.cpp
More file actions
52 lines (52 loc) · 749 Bytes
/
Copy pathQuick Sort.cpp
File metadata and controls
52 lines (52 loc) · 749 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
////
//// Created by Ts on 2018/3/20.
////
//
////
//// Created by Ts on 2018/3/20.
////
//#include <stdio.h>
//int a[] = { 9,8,7,6,5,4,3,2,1,0 };
//void swap(int&a, int&b)
//{
// int c = a;
// a = b;
// b = c;
//}
//void output()
//{
// for (int i = 0; i < 10; i++)
// {
// printf("%d", a[i]);
// printf(" ");
// }
// printf("\n");
//}
//
//void quick_sort(int Left, int Right)
//{
// if (Left >= Right)return;
// int l = Left, r = Right;
// int key = a[l];
// while (l < r)
// {
// while (a[r] > key)
// {
// r--;
// }
// swap(a[l], a[r]);
// while (a[l] < key)
// {
// l++;
// }
// swap(a[l], a[r]);
// }
// quick_sort(Left, l - 1);
// quick_sort(l+1, Right);
//}
//int main()
//{
// quick_sort(0, 9);
// output();
// return 0;
//}