Recursion size

Consider the recursive functions below which output the same value:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
def rec1(n):
    if n <=1:
        return 1
    else:
        return 2*rec1(n-1)
def rec2(n):
    if n<=1:
        return 1
    else:
        return rec2(n-1) + rec2(n-1)

What is the running time of the algorithms?

×

Problem Loading...

Note Loading...

Set Loading...