質問するログイン新規登録

質問編集履歴

4

2019/07/20 12:54

投稿

xxxrrrr
xxxrrrr

スコア17

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
- printf("%d",d[i]);
16
+ printf("%d",d[i]);
17
17
  printf("\n\n");
18
18
  system("pause");
19
19
  return 0;

3

2019/07/20 12:54

投稿

xxxrrrr
xxxrrrr

スコア17

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
- L++;
29
+ L++;
30
30
  while(d[pivot]<d[R])
31
- R--;
31
+ R--;
32
32
  if(L<R){
33
- tmp=d[L];
33
+ tmp=d[L];
34
- d[L]=d[R];
34
+ d[L]=d[R];
35
- d[R]=tmp;
35
+ d[R]=tmp;
36
36
  }
37
37
  }
38
38
  if(lp<pivot-1)

2

2019/07/20 12:53

投稿

xxxrrrr
xxxrrrr

スコア17

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
- while(d[L]<d[pivot])
28
+ while(d[L]<d[pivot])
29
- L++;
29
+ L++;
30
- while(d[pivot]<d[R])
30
+ while(d[pivot]<d[R])
31
- R--;
31
+ R--;
32
- if(L<R){
32
+ if(L<R){
33
- tmp=d[L];
33
+ tmp=d[L];
34
- d[L]=d[R];
34
+ d[L]=d[R];
35
- d[R]=tmp;
35
+ d[R]=tmp;
36
- }
36
+ }
37
37
  }
38
38
  if(lp<pivot-1)
39
- qui_sort(lp,pivot-1);
39
+ qui_sort(lp,pivot-1);
40
40
  if(pivot+1<rp)
41
- qui_sort(pivot+1,rp);
41
+ qui_sort(pivot+1,rp);
42
42
  }
43
43
 
44
44
  ```

1

2019/07/20 12:52

投稿

xxxrrrr
xxxrrrr

スコア17

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