質問編集履歴
1
試行
test
CHANGED
File without changes
|
test
CHANGED
@@ -240,4 +240,24 @@
|
|
240
240
|
|
241
241
|
###補足情報(言語/FW/ツール等のバージョンなど)
|
242
242
|
|
243
|
+
|
244
|
+
|
245
|
+
public int setHeight(int id){
|
246
|
+
|
247
|
+
if(id == -1)
|
248
|
+
|
249
|
+
return -1;
|
250
|
+
|
251
|
+
int l = nodes[id].left;
|
252
|
+
|
253
|
+
int r = nodes[id].right;
|
254
|
+
|
255
|
+
nodes[id].height = Math.max(setHeight(l), setHeight(r)) + 1;
|
256
|
+
|
257
|
+
return nodes[id].height;
|
258
|
+
|
259
|
+
}
|
260
|
+
|
261
|
+
|
262
|
+
|
243
|
-
|
263
|
+
これでいいのかな。
|