2017-02-15 4 views
-1

나는 점근 시간의 복잡성에 관해 빠른 질문을 가지고 있습니다. 이 함수의 시간 복잡도 (big O)는 아래에서 무엇입니까? 내가 이해하는 바에 따르면, 그것은 무한 재귀 인 것처럼 보이며, 그렇게 큰 O 표기법은 무엇일까?시간 복잡도 무한 재귀

def asymptoticTest (int1, int2): 
    if int1 < int2: 
    asymptoticTest(int1 + 1, int2) 
    elif int1 > int2: 
    asymptoticTest(int1 - 1, int2) 
    else: 
    asymptoticTest(int2, int1) 
+0

O (무한대)? http://stackoverflow.com/questions/5627390/o-notation-o%E2%88%9E-o1 –

+0

과 유사합니다. 아마도 CS Stackexchange에 대한 답변이 더 좋을 것입니다. http://cs.stackexchange.com/questions/56556/complexity-analysis-of-an-solsolveable-algorithmic-problem – Brandin

답변

1

입력에 따라 일정한 시간 (무한대)이 걸리므로이 O (1)을 호출합니다. O (1)은 "빠름"을 의미하지 않으며, 단지 상수를 의미합니다.