DSA Python Recursion Question 6

Last Updated :
Discuss
Comments

Observe the following Python code?

def a(n):

    if n == 0:

        return 0

    else:

        return n*a(n - 1)

def b(n, tot):

    if n == 0:

        return tot

    Else:

return b(n-2, tot-2)

Both a() and b() aren’t tail recursive

b() is tail recursive but a() isn’t

a() is tail recursive but b() isn’t

Both a() and b() are tail recursive

Share your thoughts in the comments