0

I am to find the time complexity of my algorithm and I found one method here.
However I am really not sure about it correctness thus I would like to check it.
There is my algorithm (N is a set (len(N) is constant) and C is a number):

def f(N, C, k = 0):
    if C < 0:
        return 0
    if C == 0:
        return 1
    if not N:
        return 0
    i = 0
    for l in N:
        if l >= k:
            i += f(N, C - liczba, liczba)
    return i

And to my mind time complexity is equal to:
a+b+c+d+len(N)*C where a, b, c, d are constants.

Raphael
  • 73,212
  • 30
  • 182
  • 400
Hendrra
  • 101
  • 1

0 Answers0