-1
我有一個關於漸近時間複雜度的快速問題。下面這個函數的時間複雜度(大O)是什麼?根據我的理解,它似乎是無限的遞歸,因此,這將是什麼大O符號?時間複雜度無限遞歸
def asymptoticTest (int1, int2):
if int1 < int2:
asymptoticTest(int1 + 1, int2)
elif int1 > int2:
asymptoticTest(int1 - 1, int2)
else:
asymptoticTest(int2, int1)
O(無窮遠)?類似於http://stackoverflow.com/questions/5627390/o-notation-o%E2%88%9E-o1 –
在CS Stackexchange上可能有更好的答案,例如http://cs.stackexchange.com/questions/56556/complexity-analysis-of-an-unsolvable-algorithmic-problem – Brandin