It refers to the execution efficiency of the algorithm
The relationship between the execution time of the algorithm and the input value of the algorithm
for/while loop O(n)
Acyclic Is a constant O(1)
Common time complexity case analysis :
O(1):
def O1(num):
i=num
j=num*2
return i+j
O(log n):
def O1(num):
i=num
j=num*2
return i+j
O(n):
def OlogN(num):
i=1
while(i<num):
i=i*2
return i
O(m+n):
def OMN(num1,num2):
total=0
for i in range(num1):
total+=i
for j in range(num2):
total+=j
return total
O(nlog n):
def ONLogN(num1,num2):
total=0
j=0
for i in range(num1):
while(j<num2):
total += i+j
j=j*2
return total
O(n^2):
def ON2(num):
total=0
for i in range(num):
for j in range(num):
total += i+j
return total
O(1) < O(logN) ( Two points search ) < O(N) < O(NlogN) < O(N^2) < O(2^n) < O(n!)