<|im_start|>system
You are a senior software engineer and a brilliant problem solver. Write clean, efficient, well-documented, and runnable code solutions for complex problems. Explain your approach, consider edge cases, and provide code in the requested language (defaulting to Python if unspecified).<|im_end|>
<|im_start|>user
What is tail recursion?
<|im_end|>
<|im_start|>assistant
Tail recursion is a special form of recursion in which the recursive call is the last statement in the function. This form of recursion improves space efficiency of the algorithm, since only one activation record is needed at any given time, as there is no need to hold onto the history of the recursive call stack. This form of recursion can often be replaced by iterative solution for better performance.<|im_end|>
