What is the time complexity of adding a for to fast platoon?

beginner to learn the algorithm, do not quite understand the concept of this block, such as a function

function fn(){
    //
    //for(i = 0; i < n; iPP){}
}

if this is the case, how to calculate the time complexity? is it O (nlogn+n), or can it not be calculated this way?
I hope you will not hesitate to comment

.
Mar.10,2021

the big o (nlogn)


Baidu encyclopedia:

when calculating the time complexity, first find out the basic operation of the algorithm, then determine its execution times according to the corresponding statements, and then find out the of the same order of magnitude of T (n) (its order of magnitude is as follows: 1 the square of n log2n,n, the third power of n, the n power of 2, n!). After finding out, f (n) = this order of magnitude. If the T (n) / f (n) limit can get a constant c, then the time complexity T (n) = O (f (n))
example: algorithm:


<strong></strong>log<strong></strong><br>:

O(N+N) = O(2N) = O(N)
O(N^2+N) = O(N^2)

this should be based on the related ideas of infinity in mathematics. I hope it can help you.

Menu