The conversation between human and AI assistant.
What are the various types of algorithms that use recursion?
That's interesting. Can you give me an example of a recursive function in programming?
Sure! Here's an example of a recursive function in Python that calculates the factorial of a number:
```
def factorial(n):
    if n == 1:
        return 1
    else:
        return n * factorial(n-1)
```
This function uses recursion to calculate the factorial of a number n by calling itself with n-1 until n = 1.