質問編集履歴
4
title
CHANGED
File without changes
|
body
CHANGED
@@ -13,7 +13,7 @@
|
|
13
13
|
int main(void){
|
14
14
|
qui_sort(lp,rp);
|
15
15
|
for(i=0;i<10;i++)
|
16
|
-
|
16
|
+
printf("%d",d[i]);
|
17
17
|
printf("\n\n");
|
18
18
|
system("pause");
|
19
19
|
return 0;
|
3
title
CHANGED
File without changes
|
body
CHANGED
@@ -26,13 +26,13 @@
|
|
26
26
|
|
27
27
|
while(L<R){
|
28
28
|
while(d[L]<d[pivot])
|
29
|
-
|
29
|
+
L++;
|
30
30
|
while(d[pivot]<d[R])
|
31
|
-
|
31
|
+
R--;
|
32
32
|
if(L<R){
|
33
|
-
|
33
|
+
tmp=d[L];
|
34
|
-
|
34
|
+
d[L]=d[R];
|
35
|
-
|
35
|
+
d[R]=tmp;
|
36
36
|
}
|
37
37
|
}
|
38
38
|
if(lp<pivot-1)
|
2
title
CHANGED
File without changes
|
body
CHANGED
@@ -25,20 +25,20 @@
|
|
25
25
|
pivot=L; //ここを(L+R)/2にするとおかしくなる
|
26
26
|
|
27
27
|
while(L<R){
|
28
|
-
|
28
|
+
while(d[L]<d[pivot])
|
29
|
-
|
29
|
+
L++;
|
30
|
-
|
30
|
+
while(d[pivot]<d[R])
|
31
|
-
|
31
|
+
R--;
|
32
|
-
|
32
|
+
if(L<R){
|
33
|
-
|
33
|
+
tmp=d[L];
|
34
|
-
|
34
|
+
d[L]=d[R];
|
35
|
-
|
35
|
+
d[R]=tmp;
|
36
|
-
|
36
|
+
}
|
37
37
|
}
|
38
38
|
if(lp<pivot-1)
|
39
|
-
|
39
|
+
qui_sort(lp,pivot-1);
|
40
40
|
if(pivot+1<rp)
|
41
|
-
|
41
|
+
qui_sort(pivot+1,rp);
|
42
42
|
}
|
43
43
|
|
44
44
|
```
|
1
title
CHANGED
File without changes
|
body
CHANGED
@@ -11,34 +11,34 @@
|
|
11
11
|
int tmp,i;
|
12
12
|
|
13
13
|
int main(void){
|
14
|
-
|
14
|
+
qui_sort(lp,rp);
|
15
|
-
|
15
|
+
for(i=0;i<10;i++)
|
16
|
-
|
16
|
+
printf("%d",d[i]);
|
17
|
-
|
17
|
+
printf("\n\n");
|
18
|
-
|
18
|
+
system("pause");
|
19
|
-
|
19
|
+
return 0;
|
20
20
|
}
|
21
21
|
void qui_sort(int lp,int rp){
|
22
|
-
|
22
|
+
int L,R,pivot;
|
23
|
-
|
23
|
+
L=lp;
|
24
|
-
|
24
|
+
R=rp;
|
25
|
-
|
25
|
+
pivot=L; //ここを(L+R)/2にするとおかしくなる
|
26
26
|
|
27
|
-
|
27
|
+
while(L<R){
|
28
|
-
|
28
|
+
while(d[L]<d[pivot])
|
29
|
-
|
29
|
+
L++;
|
30
|
-
|
30
|
+
while(d[pivot]<d[R])
|
31
|
-
|
31
|
+
R--;
|
32
|
-
|
32
|
+
if(L<R){
|
33
|
-
|
33
|
+
tmp=d[L];
|
34
|
-
|
34
|
+
d[L]=d[R];
|
35
|
-
|
35
|
+
d[R]=tmp;
|
36
|
-
|
36
|
+
}
|
37
|
-
|
37
|
+
}
|
38
|
-
|
38
|
+
if(lp<pivot-1)
|
39
|
-
|
39
|
+
qui_sort(lp,pivot-1);
|
40
|
-
|
40
|
+
if(pivot+1<rp)
|
41
|
-
|
41
|
+
qui_sort(pivot+1,rp);
|
42
42
|
}
|
43
43
|
|
44
44
|
```
|