Skip to content

Commit c27a7b4

Browse files
committed
closes #3185
1 parent aedeed3 commit c27a7b4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

1-js/06-advanced-functions/01-recursion/article.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ When `pow(x, n)` is called, the execution splits into two branches:
6161
if n==1 = x
6262
/
6363
pow(x, n) =
64-
\
64+
\
6565
else = x * pow(x, n - 1)
6666
```
6767

@@ -285,7 +285,7 @@ The iterative `pow` uses a single context changing `i` and `result` in the proce
285285
286286
**Any recursion can be rewritten as a loop. The loop variant usually can be made more effective.**
287287
288-
...But sometimes the rewrite is non-trivial, especially when function uses different recursive subcalls depending on conditions and merges their results or when the branching is more intricate. And the optimization may be unneeded and totally not worth the efforts.
288+
...But sometimes the rewrite is non-trivial, especially when a function uses different recursive subcalls depending on conditions and merges their results or when the branching is more intricate. And the optimization may be unneeded and totally not worth the efforts.
289289
290290
Recursion can give a shorter code, easier to understand and support. Optimizations are not required in every place, mostly we need a good code, that's why it's used.
291291

0 commit comments

Comments
 (0)