计算算法的Big O表示法

时间:2018-05-12 07:02:08

标签: python-3.x algorithm time-complexity big-o

我被要求解释关于Big O表示法并计算算法的Big o表示法。我完成了定义部分,但我仍然想知道如何计算它。有人可以帮我计算下面给出代码的Big O吗?

new = int (input("enter number" ))
if new <= 10000:
    comm=new*2/100
    print (comm)
else :
    comm= new*5/100
    print (comm)

1 个答案:

答案 0 :(得分:1)

由于没有循环,因此它是O(1)。