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
+25 -25
View File
@@ -6,7 +6,7 @@
#include "../utils/common.hpp"
/* 配列表現による二分木クラス */
/* 配列で表した二分木クラス */
class ArrayBinaryTree {
public:
/* コンストラクタ */
@@ -14,30 +14,30 @@ class ArrayBinaryTree {
tree = arr;
}
/* リスト容量 */
/* リストの容量 */
int size() {
return tree.size();
}
/* インデックス i のノードの値を取得 */
/* インデックス i のノードの値を取得する */
int val(int i) {
// インデックスが範囲外なら、空きを表す INT_MAX を返す
// インデックスが範囲外の場合、空きを表す INT_MAX を返す
if (i < 0 || i >= size())
return INT_MAX;
return tree[i];
}
/* インデックス i のノードの左子ノードのインデックスを取得 */
/* インデックス i のノードの左の子ノードのインデックスを取得する */
int left(int i) {
return 2 * i + 1;
}
/* インデックス i のノードの右子ノードのインデックスを取得 */
/* インデックス i のノードの右の子ノードのインデックスを取得する */
int right(int i) {
return 2 * i + 2;
}
/* インデックス i のノードの親ノードのインデックスを取得 */
/* インデックス i のノードの親ノードのインデックスを取得する */
int parent(int i) {
return (i - 1) / 2;
}
@@ -45,7 +45,7 @@ class ArrayBinaryTree {
/* レベル順走査 */
vector<int> levelOrder() {
vector<int> res;
// 配列を直接走査する
// 配列をそのまま走査する
for (int i = 0; i < size(); i++) {
if (val(i) != INT_MAX)
res.push_back(val(i));
@@ -53,21 +53,21 @@ class ArrayBinaryTree {
return res;
}
/* 先行順走査 */
/* 行きがけ順走査 */
vector<int> preOrder() {
vector<int> res;
dfs(0, "pre", res);
return res;
}
/* 中順走査 */
/* 通りがけ順走査 */
vector<int> inOrder() {
vector<int> res;
dfs(0, "in", res);
return res;
}
/* 後順走査 */
/* 帰りがけ順走査 */
vector<int> postOrder() {
vector<int> res;
dfs(0, "post", res);
@@ -77,41 +77,41 @@ class ArrayBinaryTree {
private:
vector<int> tree;
/* 深さ優先探索 */
/* 深さ優先走査 */
void dfs(int i, string order, vector<int> &res) {
// 空きスロットなら返す
// 空きの場合、戻る
if (val(i) == INT_MAX)
return;
// 先行順走査
// 行きがけ順走査
if (order == "pre")
res.push_back(val(i));
dfs(left(i), order, res);
// 中順走査
// 通りがけ順走査
if (order == "in")
res.push_back(val(i));
dfs(right(i), order, res);
// 後順走査
// 帰りがけ順走査
if (order == "post")
res.push_back(val(i));
}
};
/* Driver Code */
/* 実行用コード */
int main() {
// 二分木を初期化する
// 空き位置 nullptr は INT_MAX で表す
// INT_MAX で空き nullptr を表す
vector<int> arr = {1, 2, 3, 4, INT_MAX, 6, 7, 8, 9, INT_MAX, INT_MAX, 12, INT_MAX, INT_MAX, 15};
TreeNode *root = vectorToTree(arr);
cout << "\n二分木を初期化\n";
cout << "\n二分木を初期化する\n";
cout << "二分木の配列表現:\n";
printVector(arr);
cout << "二分木の連結リスト表現:\n";
printTree(root);
// 配列表現による二分木クラス
// 配列で表した二分木クラス
ArrayBinaryTree abt(arr);
// ノードにアクセス
// ノードにアクセスする
int i = 1;
int l = abt.left(i), r = abt.right(i), p = abt.parent(i);
cout << "\n現在のノードのインデックスは " << i << "、値は " << abt.val(i) << "\n";
@@ -119,18 +119,18 @@ int main() {
cout << "右の子ノードのインデックスは " << r << "、値は " << (abt.val(r) != INT_MAX ? to_string(abt.val(r)) : "nullptr") << "\n";
cout << "親ノードのインデックスは " << p << "、値は " << (abt.val(p) != INT_MAX ? to_string(abt.val(p)) : "nullptr") << "\n";
// 木を走査
// 木を走査する
vector<int> res = abt.levelOrder();
cout << "\nレベル順走査: ";
printVector(res);
res = abt.preOrder();
cout << "先行順走査: ";
cout << "行きがけ順走査: ";
printVector(res);
res = abt.inOrder();
cout << "中間順走査: ";
cout << "通りがけ順走査: ";
printVector(res);
res = abt.postOrder();
cout << "後行順走査: ";
cout << "帰りがけ順走査: ";
printVector(res);
return 0;