-
-
Notifications
You must be signed in to change notification settings - Fork 627
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d4b91b3
commit c56bfe9
Showing
1 changed file
with
9 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
### About Recursion | ||
|
||
Recursion is a programming technique where a function calls itself to solve smaller instances of the same problem. It’s a powerful tool for breaking down problems that can be divided into smaller, similar sub-problems. However, recursion can quickly run into issues such as **Memory Allocation Errors** or **Maximum Call Stack Size Exceeded** if not handled carefully. | ||
|
||
In JavaScript, one important limitation is the **lack of Tail-Call Optimization (TCO)**. Tail-call optimization allows the language engine to reuse the stack frame for recursive calls when they occur at the end of a function. Unfortunately, JavaScript does not support TCO, which means that deeply nested recursive calls can lead to a stack overflow. | ||
|
||
### Interesting Facts: | ||
- Recursion is widely used in problems such as tree traversal, factorial calculation, and Fibonacci sequences. | ||
- JavaScript does not optimize tail calls, unlike other languages such as Scheme or Haskell. |