Retranslate the complete English edition from Simplified Chinese (#2010)

* Retranslate the complete English edition from Simplified Chinese

* Polish three English explanations after reader-focused review
This commit is contained in:
Yudong Jin
2026-10-31 03:35:51 +08:00
committed by GitHub
parent ef46e2ed95
commit 14c314c08c
1502 changed files with 29459 additions and 23517 deletions

View File

@@ -7,7 +7,7 @@
package chapter_computational_complexity;
public class complexity_exercises {
/* Iterative summation */
/* Sum using iteration */
static int sumIter(int n) {
int res = 0;
for (int i = 1; i <= n; i++) {
@@ -16,7 +16,7 @@ public class complexity_exercises {
return res;
}
/* Recursive summation */
/* Sum using recursion */
static int sumRecur(int n) {
if (n == 1) {
return 1;
@@ -24,7 +24,7 @@ public class complexity_exercises {
return n + sumRecur(n - 1);
}
/* Linear loop */
/* Linear-time loop */
static int linearLoop(int n) {
int res = 0;
for (int i = 0; i < n; i++) {
@@ -33,7 +33,7 @@ public class complexity_exercises {
return res;
}
/* Quadratic loop */
/* Quadratic-time loop */
static int quadraticLoop(int n) {
int res = 0;
for (int i = 0; i < n; i++) {
@@ -44,7 +44,7 @@ public class complexity_exercises {
return res;
}
/* Logarithmic loop */
/* Logarithmic-time loop */
static int logarithmicLoop(int n) {
while (n > 1) {
n /= 2;