Skip to content

Commit 5d46240

Browse files
committed
Adding index term and new paragraph in Chapter 7
1 parent b586f9a commit 5d46240

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

source/ch7_recursion.ptx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,10 @@ public class ArrayProcessor {
284284
<li>In Java, this throws a <c>StackOverflowError</c>.</li>
285285
</ul>
286286
<p>
287-
Neither language supports <idx> tail call optimization </idx><term>tail call optimization</term>, so the practical limits on recursion depth are a factor in both. If an algorithm requires thousands of recursive calls, an iterative, loop-based, approach is likely going to be the preferred solution in both Python and Java.
287+
Neither language supports tail call optimization, so the practical limits on recursion depth are a factor in both. If an algorithm requires thousands of recursive calls, an iterative, loop-based, approach is likely going to be the preferred solution in both Python and Java.
288288
</p>
289+
<p><idx> Tail Call Optimization </idx> <term>Tail Call Optimization</term> (TCO) is a technique used in programming to improve the efficiency of recursive function calls by reusing the current function's stack frame instead of creating a new one. This helps prevent stack overflow errors and reduces memory usage, especially in languages that support it.</p>
290+
289291
<p>
290292
The following Python code demonstrates a situation where a function calls itself indefinitely without a base case, leading to a <c>RecursionError</c>.
291293
</p>

0 commit comments

Comments
 (0)