Skip to content

Commit 69eac7d

Browse files
zairahirajdwilkin4
andauthored
feat(curriculum): adding content for recursion review page (freeCodeCamp#57308)
Co-authored-by: Jessica Wilkins <67210629+jdwilkin4@users.noreply.github.com>
1 parent d33f504 commit 69eac7d

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

client/i18n/locales/english/intro.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3192,7 +3192,8 @@
31923192
"review-recursion": {
31933193
"title": "Recursion Review",
31943194
"intro": [
3195-
"Review the Recursion concepts to prepare for the upcoming quiz."
3195+
"Before you are quizzed on the recursion, you first need to review the concepts.",
3196+
"Open up this page to review what is recursion and what is it used for."
31963197
]
31973198
},
31983199
"quiz-recursion": {

curriculum/challenges/english/25-front-end-development/review-recursion/6723d1f0568292cd394d6fb6.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,25 @@ dashedName: review-recursion
99

1010
Review the concepts below to prepare for the upcoming quiz.
1111

12+
- Recursion is programming concept that allows you to call a function repeatedly until a base-case is reached.
1213

14+
Here is an example of a recursive function that calculates the factorial of a number:
15+
16+
```js
17+
function findFactorial(n) {
18+
if (n === 0) {
19+
return 1;
20+
}
21+
return n * findFactorial(n - 1);
22+
}
23+
```
24+
25+
In the above example, the `findFactorial` function is called recursively until `n` reaches `0`. When `n` is `0`, the base case is reached and the function returns `1`. The function then returns the product of `n` and the result of the recursive call to `findFactorial(n - 1)`.
26+
27+
- Recursion allows you to handle something with an unknown depth, such as deeply nested objects/arrays, or a file tree.
28+
- A call stack is used to keep track of the function calls in a recursive function. Each time a function is called, it is added to the call stack. When the base case is reached, the function calls are removed off the stack.
29+
- - You should carefully define the base case as calling it indefinitely can cause your code to crash. This is because the recursion keeps piling more and more function calls till the system runs out of memory.
30+
- Recursions find their uses in solving mathematical problems like factorial and Fibonacci, traversing trees and graphs, generating permutations and combinations and much more.
1331

1432
# --assignment--
1533

0 commit comments

Comments
 (0)