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

@@ -15,7 +15,7 @@ public class ListNode {
val = x;
}
/* リストを連結リストにデシリアライズ */
/* リストを連結リストにデシリアライズする */
public static ListNode arrToLinkedList(int[] arr) {
ListNode dum = new ListNode(0);
ListNode head = dum;
@@ -25,4 +25,4 @@ public class ListNode {
}
return dum.next;
}
}
}

View File

@@ -19,7 +19,7 @@ class Trunk {
};
public class PrintUtil {
/* 行列を印刷 (配列) */
/* 行列を出力するArray */
public static <T> void printMatrix(T[][] matrix) {
System.out.println("[");
for (T[] row : matrix) {
@@ -28,7 +28,7 @@ public class PrintUtil {
System.out.println("]");
}
/* 行列を印刷 (リスト) */
/* 行列を出力するList */
public static <T> void printMatrix(List<List<T>> matrix) {
System.out.println("[");
for (List<T> row : matrix) {
@@ -37,7 +37,7 @@ public class PrintUtil {
System.out.println("]");
}
/* 連結リストを印刷 */
/* 連結リストを出力 */
public static void printLinkedList(ListNode head) {
List<String> list = new ArrayList<>();
while (head != null) {
@@ -47,16 +47,16 @@ public class PrintUtil {
System.out.println(String.join(" -> ", list));
}
/* 二分木を印刷 */
/* 二分木を出力 */
public static void printTree(TreeNode root) {
printTree(root, null, false);
}
/**
* 二分木を印刷
* この木プリンターはTECHIE DELIGHTから借用
* https://www.techiedelight.com/c-program-print-binary-tree/
*/
* 二分木を出力
* This tree printer is borrowed from TECHIE DELIGHT
* https://www.techiedelight.com/c-program-print-binary-tree/
*/
public static void printTree(TreeNode root, Trunk prev, boolean isRight) {
if (root == null) {
return;
@@ -97,20 +97,20 @@ public class PrintUtil {
System.out.print(p.str);
}
/* ハッシュテーブルを印刷 */
/* ハッシュテーブルを出力 */
public static <K, V> void printHashMap(Map<K, V> map) {
for (Map.Entry<K, V> kv : map.entrySet()) {
System.out.println(kv.getKey() + " -> " + kv.getValue());
}
}
/* ヒープを印刷 (優先度キュー) */
/* ヒープ優先度付きキュー)を出力する */
public static void printHeap(Queue<Integer> queue) {
List<Integer> list = new ArrayList<>(queue);
System.out.print("ヒープの配列表現:");
System.out.print("ヒープの配列表現");
System.out.println(list);
System.out.println("ヒープの木表現:");
System.out.println("ヒープの木構造表現");
TreeNode root = TreeNode.listToTree(list);
printTree(root);
}
}
}

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;
}
}
}

View File

@@ -16,7 +16,7 @@ public class Vertex {
this.val = val;
}
/* 値リストvalsを入力し、頂点リストvetsを返す */
/* 値リスト vals を入力し、頂点リスト vets を返す */
public static Vertex[] valsToVets(int[] vals) {
Vertex[] vets = new Vertex[vals.length];
for (int i = 0; i < vals.length; i++) {
@@ -25,7 +25,7 @@ public class Vertex {
return vets;
}
/* 頂点リストvetsを入力し、値リストvalsを返す */
/* 頂点リスト vets を入力し、値リスト vals を返す */
public static List<Integer> vetsToVals(List<Vertex> vets) {
List<Integer> vals = new ArrayList<>();
for (Vertex vet : vets) {
@@ -33,4 +33,4 @@ public class Vertex {
}
return vals;
}
}
}