質問編集履歴
6
誤字
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
+
int enemy_x[]=new int[10], enemy_y[]=new int[10];
|
1
|
-
|
2
|
+
int enemy_speed[]=new int[10];
|
3
|
+
int enemy_hp[]=new int[10];
|
4
|
+
void setup(){
|
2
|
-
|
5
|
+
size(500,500);
|
3
|
-
|
6
|
+
for(int i=0;i<10;i++){
|
4
|
-
|
7
|
+
enemy_x[i]=int(random(width));
|
8
|
+
enemy_y[i]=-50;
|
5
|
-
|
9
|
+
enemy_speed[i]=int(random(2,6));
|
6
|
-
|
10
|
+
enemy_hp[i]=100;
|
7
|
-
a[j - 1] = a[j];
|
8
|
-
a[j] = temp;
|
9
|
-
|
11
|
+
}
|
10
|
-
}
|
11
|
-
}
|
12
12
|
}
|
5
ミスを見つけた
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,22 +1,12 @@
|
|
1
|
-
#include <stdio.h>
|
2
|
-
|
1
|
+
void bubble(int a[], int n) {
|
3
|
-
|
2
|
+
int i, j, temp;
|
4
|
-
|
3
|
+
for (i = 0; i < n - 1; i++) {
|
5
|
-
|
4
|
+
for (j = n - 1; j > i; j--) {
|
5
|
+
if (a[j - 1] < a[j]) {
|
6
|
+
temp = a[j - 1];
|
7
|
+
a[j - 1] = a[j];
|
8
|
+
a[j] = temp;
|
6
|
-
|
9
|
+
}
|
7
|
-
|
8
|
-
for (i = 0; i < nx; i++) {
|
9
|
-
idx = x[i] % 14;
|
10
|
-
temp = malloc(sizeof(Node));
|
11
|
-
temp->data = x[i];
|
12
|
-
table[idx] = temp;
|
13
|
-
}
|
14
|
-
|
15
|
-
for (i = 0; i < 13; i++) {
|
16
|
-
printf("%d: ", i);
|
17
|
-
if (table[i] != NULL) {
|
18
|
-
printf(" %d", table[i]->data);
|
19
10
|
}
|
20
|
-
printf("\n");
|
21
11
|
}
|
22
12
|
}
|
4
ミスを見つけた
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
c言語
|
1
|
+
c言語 基礎
|
body
CHANGED
File without changes
|
3
ミスを見つけた
title
CHANGED
File without changes
|
body
CHANGED
@@ -1,26 +1,17 @@
|
|
1
1
|
#include <stdio.h>
|
2
2
|
#include <stdlib.h>
|
3
3
|
|
4
|
-
|
4
|
+
|
5
|
-
|
5
|
+
|
6
|
-
} Node;
|
7
|
-
int main(void) {
|
8
|
-
Node *table[10];
|
9
|
-
Node *temp;
|
10
|
-
int x[] = { 1, 25, 3, 12, 34, 15, 5, 9, 11, 31 };
|
11
|
-
int nx = sizeof(x) / sizeof(int);
|
12
|
-
int i, idx; // ハッシュ表の初期化
|
13
|
-
for (i = 0; i < 13; i++) {
|
14
|
-
table[i] = NULL;
|
15
6
|
}
|
16
|
-
|
7
|
+
|
17
8
|
for (i = 0; i < nx; i++) {
|
18
9
|
idx = x[i] % 14;
|
19
10
|
temp = malloc(sizeof(Node));
|
20
11
|
temp->data = x[i];
|
21
12
|
table[idx] = temp;
|
22
13
|
}
|
23
|
-
|
14
|
+
|
24
15
|
for (i = 0; i < 13; i++) {
|
25
16
|
printf("%d: ", i);
|
26
17
|
if (table[i] != NULL) {
|
@@ -28,16 +19,4 @@
|
|
28
19
|
}
|
29
20
|
printf("\n");
|
30
21
|
}
|
31
|
-
}
|
22
|
+
}
|
32
|
-
|
33
|
-
|
34
|
-
このプログラムはハッシュ法で数字を13で割り余りをidxに入れて行っているものです。
|
35
|
-
ここからハッシュ値が同じとなる値を線形リストで管理するチェイン法を作りたいです。
|
36
|
-
|
37
|
-
|
38
|
-
typedef struct __node { int data;
|
39
|
-
struct __node *next;
|
40
|
-
} Node;
|
41
|
-
|
42
|
-
に変更して行いたいです。
|
43
|
-
ヒントややり方を教えて欲しいです。
|
2
誤字
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
チェイン法の基礎
|
1
|
+
c言語 チェイン法の基礎
|
body
CHANGED
@@ -40,5 +40,4 @@
|
|
40
40
|
} Node;
|
41
41
|
|
42
42
|
に変更して行いたいです。
|
43
|
-
|
44
|
-
やり方
|
43
|
+
ヒントややり方を教えて欲しいです。
|
1
誤字
title
CHANGED
File without changes
|
body
CHANGED
@@ -15,7 +15,7 @@
|
|
15
15
|
}
|
16
16
|
// ハッシュ表への値の追加
|
17
17
|
for (i = 0; i < nx; i++) {
|
18
|
-
idx = x[i] %
|
18
|
+
idx = x[i] % 14;
|
19
19
|
temp = malloc(sizeof(Node));
|
20
20
|
temp->data = x[i];
|
21
21
|
table[idx] = temp;
|