Suppose we have the function below:
def func(n): for i in range(n): for j in range(n - i): for k in range(n - j): if i + j + k == 0: break if i + j == 0: break if i == 0: break return n + 1
We have three nested for-loops and the total number of elements evaluated appears to be: (n)(n-1)(n-2). However, this cannot be correct, as I know the time complexity of this function is not O(n^3). What is the proper way to evaluate the time complexity of this function?