mirror of
https://github.com/krahets/hello-algo.git
synced 2026-11-26 00:30:41 +08:00
Cite the shared TreeNode for the AVL node and the C binary tree node (#2037)
Batch 3b of the runnable-snippets plan. avl_tree_node now cites each language's shared TreeNode in all 13 languages, and the C tree_node_class shares the same region. Rust gets an import region; Java, C#, Swift and Kotlin skip their serialization helpers with an adjacent region. The shared nodes gain reviewed field comments in C++ and Rust, aligned comments in Java, Swift and Kotlin, and a spacing fix in JavaScript. The AVL section adds one sentence saying the shared node class already has height. Four ru Rust files whose multi-line statements had collapsed into literal \n now compile again. en, ja, ko and zh-hant are regenerated; ru is synced by hand. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
bcd86fc1ed
commit
b113cb425a
@@ -8,17 +8,19 @@ package utils;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
// [region]{tree_node}
|
||||
/* 二分木のノードクラス */
|
||||
public class TreeNode {
|
||||
public int val; // ノードの値
|
||||
public int height; // ノードの高さ
|
||||
public TreeNode left; // 左の子ノードへの参照
|
||||
public int val; // ノードの値
|
||||
public int height; // ノードの高さ
|
||||
public TreeNode left; // 左の子ノードへの参照
|
||||
public TreeNode right; // 右の子ノードへの参照
|
||||
|
||||
/* コンストラクタ */
|
||||
public TreeNode(int x) {
|
||||
val = x;
|
||||
}
|
||||
// [endregion]{tree_node}
|
||||
|
||||
// シリアライズの符号化規則は次を参照:
|
||||
// https://www.hello-algo.com/ja/chapter_tree/array_representation_of_tree/
|
||||
@@ -70,4 +72,6 @@ public class TreeNode {
|
||||
treeToListDFS(root, 0, res);
|
||||
return res;
|
||||
}
|
||||
// [region]{tree_node_end}
|
||||
}
|
||||
// [endregion]{tree_node_end}
|
||||
|
||||
Reference in New Issue
Block a user