mirror of
https://github.com/krahets/hello-algo.git
synced 2026-11-29 15:54:44 +08:00
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:
@@ -7,7 +7,7 @@
|
||||
namespace hello_algo.chapter_computational_complexity;
|
||||
|
||||
public class complexity_exercises {
|
||||
/* Iterative summation */
|
||||
/* Sum using iteration */
|
||||
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 */
|
||||
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 */
|
||||
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 */
|
||||
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 */
|
||||
int LogarithmicLoop(int n) {
|
||||
while (n > 1) {
|
||||
n /= 2;
|
||||
|
||||
Reference in New Issue
Block a user