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

@@ -12,44 +12,44 @@ import java.util.*;
public class space_complexity {
/* 関数 */
static int function() {
// 何らかの操作を実行
// 何らかの処理を行う
return 0;
}
/* 定数計算量 */
/* 定数 */
static void constant(int n) {
// 定数、変数、オブジェクトは O(1) 空間を占める
// 定数、変数、オブジェクトは O(1) 空間を占める
final int a = 0;
int b = 0;
int[] nums = new int[10000];
ListNode node = new ListNode(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++) {
function();
}
}
/* 線形計算量 */
/* 線形 */
static void linear(int n) {
// 長さ n の配列は O(n) 空間を占める
// 長さ n の配列は O(n) 空間を使用
int[] nums = new int[n];
// 長さ n のリストは O(n) 空間を占める
// 長さ n のリストは O(n) 空間を使用
List<ListNode> nodes = new ArrayList<>();
for (int i = 0; i < n; i++) {
nodes.add(new ListNode(i));
}
// 長さ n のハッシュテーブルは O(n) 空間を占める
// 長さ n のハッシュテーブルは O(n) 空間を使用
Map<Integer, String> map = new HashMap<>();
for (int i = 0; i < n; i++) {
map.put(i, String.valueOf(i));
}
}
/* 線形計算量(再帰実装) */
/* 線形時間(再帰実装) */
static void linearRecur(int n) {
System.out.println("再帰 n = " + n);
if (n == 1)
@@ -57,11 +57,11 @@ public class space_complexity {
linearRecur(n - 1);
}
/* 二次計算量 */
/* 二乗階 */
static void quadratic(int n) {
// 行列は O(n^2) 空間を占め
// 行列は O(n^2) 空間を使用す
int[][] numMatrix = new int[n][n];
// 二次元リストは O(n^2) 空間を占める
// 二次元リストは O(n^2) 空間を使用
List<List<Integer>> numList = new ArrayList<>();
for (int i = 0; i < n; i++) {
List<Integer> tmp = new ArrayList<>();
@@ -72,17 +72,17 @@ public class space_complexity {
}
}
/* 二次計算量(再帰実装) */
/* 二次時間(再帰実装) */
static int quadraticRecur(int n) {
if (n <= 0)
return 0;
// 配列 nums の長さ = n, n-1, ..., 2, 1
// 配列 nums の長さ n, n-1, ..., 2, 1
int[] nums = new int[n];
System.out.println("再帰 n = " + n + " nums の長さ = " + nums.length);
System.out.println("再帰 n = " + n + " における nums の長さ = " + nums.length);
return quadraticRecur(n - 1);
}
/* 指数計算量(完全二分木の構築) */
/* 指数時間(完全二分木の構築) */
static TreeNode buildTree(int n) {
if (n == 0)
return null;
@@ -92,19 +92,19 @@ public class space_complexity {
return root;
}
/* ドライバーコード */
/* Driver Code */
public static void main(String[] args) {
int n = 5;
// 定数計算量
// 定数
constant(n);
// 線形計算量
// 線形
linear(n);
linearRecur(n);
// 二次計算量
// 二乗階
quadratic(n);
quadraticRecur(n);
// 指数計算量
// 指数オーダー
TreeNode root = buildTree(n);
PrintUtil.printTree(root);
}
}
}