質問編集履歴
6
test
CHANGED
File without changes
|
test
CHANGED
@@ -166,6 +166,8 @@
|
|
166
166
|
|
167
167
|
}
|
168
168
|
|
169
|
+
|
170
|
+
|
169
171
|
void insert(int *H, int i, int *a)
|
170
172
|
|
171
173
|
{
|
5
test
CHANGED
File without changes
|
test
CHANGED
@@ -148,6 +148,24 @@
|
|
148
148
|
|
149
149
|
|
150
150
|
|
151
|
+
void buildheap(int *H, int *A, int n)
|
152
|
+
|
153
|
+
{
|
154
|
+
|
155
|
+
int i;
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
for(i=0; i<n; i++)
|
160
|
+
|
161
|
+
{
|
162
|
+
|
163
|
+
insert(H, i, A);
|
164
|
+
|
165
|
+
}
|
166
|
+
|
167
|
+
}
|
168
|
+
|
151
169
|
void insert(int *H, int i, int *a)
|
152
170
|
|
153
171
|
{
|
4
test
CHANGED
File without changes
|
test
CHANGED
@@ -40,7 +40,7 @@
|
|
40
40
|
|
41
41
|
void upheapsort(int *H, int i);
|
42
42
|
|
43
|
-
void downheapsort(int *H, int
|
43
|
+
void downheapsort(int *H, int i);
|
44
44
|
|
45
45
|
|
46
46
|
|
3
test
CHANGED
File without changes
|
test
CHANGED
@@ -200,8 +200,6 @@
|
|
200
200
|
|
201
201
|
|
202
202
|
|
203
|
-
|
204
|
-
|
205
203
|
int parent(int i)
|
206
204
|
|
207
205
|
{
|
@@ -220,6 +218,10 @@
|
|
220
218
|
|
221
219
|
|
222
220
|
|
221
|
+
void downheapsort(int *H, int i)
|
222
|
+
|
223
|
+
{
|
224
|
+
|
223
225
|
int l,r;
|
224
226
|
|
225
227
|
int u = 0;
|
2
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,6 +16,8 @@
|
|
16
16
|
|
17
17
|
|
18
18
|
|
19
|
+
```
|
20
|
+
|
19
21
|
|
20
22
|
|
21
23
|
#include <stdio.h>
|
@@ -319,3 +321,5 @@
|
|
319
321
|
}
|
320
322
|
|
321
323
|
}
|
324
|
+
|
325
|
+
```
|
1
test
CHANGED
File without changes
|
test
CHANGED
@@ -12,6 +12,12 @@
|
|
12
12
|
|
13
13
|
|
14
14
|
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
15
21
|
#include <stdio.h>
|
16
22
|
|
17
23
|
#include <stdlib.h>
|