Guest Session: 1 Question Remaining. Create Account to save progress.
Login
Recursionhard
0:00.0

A tail-recursive function computes f(n,acc)={accif n=0f(n−1,acc⋅n)otherwisef(n, acc) = \begin{cases} acc & \text{if } n = 0 \\ f(n-1, acc \cdot n) & \text{otherwise} \end{cases}f(n,acc)={accf(n−1,acc⋅n)​if n=0otherwise​ with initial call f(n,1)f(n, 1)f(n,1). How does the stack depth (call depth) scale with nnn when the compiler does NOT perform tail-call optimization, and how does it scale when the compiler DOES?