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

@@ -8,44 +8,44 @@
/* 関数 */
int func() {
// 何らかの操作を実行
// 何らかの処理を行う
return 0;
}
/* 定数計算量 */
/* 定数 */
void constant(int n) {
// 定数、変数、オブジェクトは O(1) 空間を占める
// 定数、変数、オブジェクトは O(1) 空間を占める
const int a = 0;
int b = 0;
vector<int> nums(10000);
ListNode node(0);
// ループ内の変数は O(1) 空間を占める
// ループ内の変数は O(1) 空間を占める
for (int i = 0; i < n; i++) {
int c = 0;
}
// ループ内の関数は O(1) 空間を占める
// ループ内の関数は O(1) 空間を占める
for (int i = 0; i < n; i++) {
func();
}
}
/* 線形計算量 */
/* 線形 */
void linear(int n) {
// 長さ n の配列は O(n) 空間を占める
// 長さ n の配列は O(n) 空間を使用
vector<int> nums(n);
// 長さ n のリストは O(n) 空間を占める
// 長さ n のリストは O(n) 空間を使用
vector<ListNode> nodes;
for (int i = 0; i < n; i++) {
nodes.push_back(ListNode(i));
}
// 長さ n のハッシュテーブルは O(n) 空間を占める
// 長さ n のハッシュテーブルは O(n) 空間を使用
unordered_map<int, string> map;
for (int i = 0; i < n; i++) {
map[i] = to_string(i);
}
}
/* 線形計算量(再帰実装) */
/* 線形時間(再帰実装) */
void linearRecur(int n) {
cout << "再帰 n = " << n << endl;
if (n == 1)
@@ -53,9 +53,9 @@ void linearRecur(int n) {
linearRecur(n - 1);
}
/* 二次計算量 */
/* 二乗階 */
void quadratic(int n) {
// 二次元リストは O(n^2) 空間を占める
// 二次元リストは O(n^2) 空間を使用
vector<vector<int>> numMatrix;
for (int i = 0; i < n; i++) {
vector<int> tmp;
@@ -66,16 +66,16 @@ void quadratic(int n) {
}
}
/* 二次計算量(再帰実装) */
/* 二次時間(再帰実装) */
int quadraticRecur(int n) {
if (n <= 0)
return 0;
vector<int> nums(n);
cout << "再帰 n = " << n << ", nums の長さ = " << nums.size() << endl;
cout << "再帰 n = " << n << " における nums の長さ = " << nums.size() << endl;
return quadraticRecur(n - 1);
}
/* 指数計算量(完全二分木の構築) */
/* 指数時間(完全二分木の構築) */
TreeNode *buildTree(int n) {
if (n == 0)
return nullptr;
@@ -85,23 +85,23 @@ TreeNode *buildTree(int n) {
return root;
}
/* ドライバーコード */
/* Driver Code */
int main() {
int n = 5;
// 定数計算量
// 定数
constant(n);
// 線形計算量
// 線形
linear(n);
linearRecur(n);
// 二次計算量
// 二乗階
quadratic(n);
quadraticRecur(n);
// 指数計算量
// 指数オーダー
TreeNode *root = buildTree(n);
printTree(root);
// メモリを解放
// メモリを解放する
freeMemoryTree(root);
return 0;
}
}