Retranslate the complete Japanese online edition from Chinese (#2008)

* Retranslate the complete Japanese online edition from Chinese

* Fit Japanese homepage labels and localize heading permalinks

* Point Japanese contribution instructions to the Japanese preview

* Replace locale conditionals with multilingual UI tables
This commit is contained in:
Yudong Jin
2026-10-30 02:12:26 +08:00
committed by GitHub
parent 455e8c1281
commit 7257641e0e
1987 changed files with 23531 additions and 23261 deletions

View File

@@ -4,12 +4,12 @@
namespace hello_algo.utils;
/* 連結リストノード */
/* 連結リストのノード */
public class ListNode(int x) {
public int val = x;
public ListNode? next;
/* 配列をデシリアライズして連結リストに変換する */
/* 配列をデシリアライズして連結リストにする */
public static ListNode? ArrToLinkedList(int[] arr) {
ListNode dum = new(0);
ListNode head = dum;

View File

@@ -12,7 +12,7 @@ public class Trunk(Trunk? prev, string str) {
};
public static class PrintUtil {
/* リストを出力する */
/* リストを表示する */
public static void PrintList<T>(IList<T> list) {
Console.WriteLine("[" + string.Join(", ", list) + "]");
}
@@ -21,7 +21,7 @@ public static class PrintUtil {
return $"[ {string.Join(", ", list.Select(x => x?.ToString() ?? "null"))} ]";
}
/* 行列を出力する (Array) */
/* 行列を表示する(Array) */
public static void PrintMatrix<T>(T[][] matrix) {
Console.WriteLine("[");
foreach (T[] row in matrix) {
@@ -30,7 +30,7 @@ public static class PrintUtil {
Console.WriteLine("]");
}
/* 行列を出力 (List) */
/* 行列を表示する(List) */
public static void PrintMatrix<T>(List<List<T>> matrix) {
Console.WriteLine("[");
foreach (List<T> row in matrix) {
@@ -39,7 +39,7 @@ public static class PrintUtil {
Console.WriteLine("]");
}
/* 連結リストを出力 */
/* 連結リストを表示する */
public static void PrintLinkedList(ListNode? head) {
List<string> list = [];
while (head != null) {
@@ -50,15 +50,15 @@ public static class PrintUtil {
}
/**
* 二分木を出力
* This tree printer is borrowed from TECHIE DELIGHT
* https://www.techiedelight.com/c-program-print-binary-tree/
*/
* 二分木を表示する
* この木の表示処理は TECHIE DELIGHT から借用した
* https://www.techiedelight.com/c-program-print-binary-tree/
*/
public static void PrintTree(TreeNode? root) {
PrintTree(root, null, false);
}
/* 二分木を出力 */
/* 二分木を表示する */
public static void PrintTree(TreeNode? root, Trunk? prev, bool isRight) {
if (root == null) {
return;
@@ -99,24 +99,24 @@ public static class PrintUtil {
Console.Write(p.str);
}
/* ハッシュテーブルを出力 */
/* ハッシュテーブルを表示する */
public static void PrintHashMap<K, V>(Dictionary<K, V> map) where K : notnull {
foreach (var kv in map.Keys) {
Console.WriteLine(kv.ToString() + " -> " + map[kv]?.ToString());
}
}
/* ヒープを出力 */
/* ヒープを表示する */
public static void PrintHeap(Queue<int> queue) {
Console.Write("ヒープの配列表現:");
List<int> list = [.. queue];
Console.WriteLine(string.Join(',', list));
Console.WriteLine("ヒープの木構造表示:");
Console.WriteLine("ヒープの木構造表現:");
TreeNode? tree = TreeNode.ListToTree(list.Cast<int?>().ToList());
PrintTree(tree);
}
/* 優先キューを出力 */
/* 優先度付きキューを表示する */
public static void PrintHeap(PriorityQueue<int, int> queue) {
var newQueue = new PriorityQueue<int, int>(queue.UnorderedItems, queue.Comparer);
Console.Write("ヒープの配列表現:");
@@ -124,7 +124,7 @@ public static class PrintUtil {
while (newQueue.TryDequeue(out int element, out _)) {
list.Add(element);
}
Console.WriteLine("ヒープの木構造表示:");
Console.WriteLine("ヒープの木構造表現:");
Console.WriteLine(string.Join(',', list.ToList()));
TreeNode? tree = TreeNode.ListToTree(list.Cast<int?>().ToList());
PrintTree(tree);

View File

@@ -6,30 +6,30 @@
namespace hello_algo.utils;
/* 二分木ノードクラス */
/* 二分木のノードクラス */
public class TreeNode(int? x) {
public int? val = x; // ノード値
public int? val = x; // ノードの値
public int height; // ノードの高さ
public TreeNode? left; // 左子ノードへの参照
public TreeNode? right; // 右子ノードへの参照
public TreeNode? left; // 左の子ノードへの参照
public TreeNode? right; // 右の子ノードへの参照
// シリアライズの符号化規則は以下を参照:
// https://www.hello-algo.com/chapter_tree/array_representation_of_tree/
// 二分木の配列表現:
// シリアライズの符号化規則は次を参照:
// https://www.hello-algo.com/ja/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
/* リストを二分木にデシリアライズする: 再帰 */
/* リストから二分木へデシリアライズ:再帰 */
static TreeNode? ListToTreeDFS(List<int?> arr, int i) {
if (i < 0 || i >= arr.Count || !arr[i].HasValue) {
return null;
@@ -41,12 +41,12 @@ public class TreeNode(int? x) {
return root;
}
/* リストを二分木にデシリアライズする */
/* リストから二分木へデシリアライズ */
public static TreeNode? ListToTree(List<int?> arr) {
return ListToTreeDFS(arr, 0);
}
/* 二分木をリストにシリアライズする: 再帰 */
/* 二分木をシリアライズしてリストにする:再帰 */
static void TreeToListDFS(TreeNode? root, int i, List<int?> res) {
if (root == null)
return;
@@ -58,7 +58,7 @@ public class TreeNode(int? x) {
TreeToListDFS(root.right, 2 * i + 2, res);
}
/* 二分木をリストにシリアライズする */
/* 二分木をシリアライズしてリストにする */
public static List<int?> TreeToList(TreeNode root) {
List<int?> res = [];
TreeToListDFS(root, 0, res);

View File

@@ -10,7 +10,7 @@ namespace hello_algo.utils;
public class Vertex(int val) {
public int 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++) {
@@ -19,7 +19,7 @@ public class Vertex(int val) {
return vets;
}
/* 頂点リスト vets を入力し、値リスト vals を返す */
/* 頂点のリスト vets を入力し、値のリスト vals を返す */
public static List<int> VetsToVals(List<Vertex> vets) {
List<int> vals = [];
foreach (Vertex vet in vets) {