Recursion

Tail Recursion

A recursive function is tail-recursive if the recursive call is the last thing executed by the function.

Tail recursion is recursion with no pending work https://www.youtube.com/watch?v=_JtPhF8MshA&ab_channel=Computerphile

The tail recursion optimization avoids maintaining caller stack and pass the control tothe next iteration. The optimization is possible only if all computation can be executedbefore the recursive call.