Re-translate the Japanese version (#1871)

* Retranslate Japanese docs with GPT-5.4

* Retranslate Japanese code with GPT-5.4
This commit is contained in:
Yudong Jin
2026-03-30 07:30:15 +08:00
committed by GitHub
parent fe6443235b
commit d7b2277d2b
1444 changed files with 83312 additions and 8363 deletions

View File

@@ -11,7 +11,7 @@ import java.util.*;
/* 二分木ノードクラス */
public class TreeNode {
public int val; // ノード値
public int height; // ノード高さ
public int height; // ノード高さ
public TreeNode left; // 左子ノードへの参照
public TreeNode right; // 右子ノードへの参照
@@ -20,23 +20,23 @@ public class TreeNode {
val = x;
}
// シリアライゼーション符号化ルールについては、次を参照
// シリアライズの符号化規則は以下を参照:
// https://www.hello-algo.com/chapter_tree/array_representation_of_tree/
// 二分木の配列表現
// 二分木の配列表現:
// [1, 2, 3, 4, None, 6, 7, 8, 9, None, None, 12, None, None, 15]
// 二分木の連結リスト表現
// /——— 15
// /——— 7
// /——— 3
// | \——— 6
// | \——— 12
// 二分木の連結リスト表現:
// /——— 15
// /——— 7
// /——— 3
// | \——— 6
// | \——— 12
// ——— 1
// \——— 2
// | /——— 9
// \——— 4
// \——— 8
// \——— 2
// | /——— 9
// \——— 4
// \——— 8
/* リストを二分木にデシリアライズ再帰 */
/* リストを二分木にデシリアライズする: 再帰 */
private static TreeNode listToTreeDFS(List<Integer> arr, int i) {
if (i < 0 || i >= arr.size() || arr.get(i) == null) {
return null;
@@ -47,12 +47,12 @@ public class TreeNode {
return root;
}
/* リストを二分木にデシリアライズ */
/* リストを二分木にデシリアライズする */
public static TreeNode listToTree(List<Integer> arr) {
return listToTreeDFS(arr, 0);
}
/* 二分木をリストにシリアライズ再帰 */
/* 二分木をリストにシリアライズする: 再帰 */
private static void treeToListDFS(TreeNode root, int i, List<Integer> res) {
if (root == null)
return;
@@ -64,10 +64,10 @@ public class TreeNode {
treeToListDFS(root.right, 2 * i + 2, res);
}
/* 二分木をリストにシリアライズ */
/* 二分木をリストにシリアライズする */
public static List<Integer> treeToList(TreeNode root) {
List<Integer> res = new ArrayList<>();
treeToListDFS(root, 0, res);
return res;
}
}
}