Finding upper bound

48 Views Asked by At

Since upper bound refers to finding the maximum amount of time (in Big-oh) the function would take, would it be save to assume that I have to find the maximum amount of time when b > n? I'm saying this because than the inner loop would have to run the maximum number of times right?

Am i on the right track? Anything else I should consider?

def someloop(n):

"""Assume n is an integer and n > 1."""

    b = 1

    while b <= n:
        i = 1
        while i < b:
            print(i)
            i = i*3
        b = b + 1