Home > Back-end >  Of new encountered a small problem
Of new encountered a small problem

Time:10-20

As shown in figure, how to solve the time complexity?

CodePudding user response:

CodePudding user response:

CodePudding user response:

Popular can be understood as the number of cycle, the specific need to read, this topic choose b

CodePudding user response:

B
See cycle through the relationship between the number of times and I
Cyclic performed n - 1, this is a linear relationship, so it is O (n)
Execution times both 100 n and 10000 n, no matter how much behind plus or minus the fixed value, it is O (n)

Calculate complexity, depending on the number and the relationship between n, and only see polynomial highest project, or index, is crucial to the whole expression of the item, ignore other and various coefficients and constants of

Such as 2 ^ n + n ^ 8 only see 2 ^ n, after all, the exponential growth faster than n how much power of the growth, complexity is O (2 ^ n)

CodePudding user response:

reference 3 floor beginners side response:
popular can be understood as the number of cycle, specific to read ah, this choice b
just learning online classes, online - no book

CodePudding user response:

Fun
reference 4 floor response:
B
See cycle through the relationship between the number of times and I
Cyclic performed n - 1, this is a linear relationship, so it is O (n)
Execution times both 100 n and 10000 n, no matter how much behind plus or minus the fixed value, it is O (n)

Calculate complexity, depending on the number and the relationship between n, and only see polynomial highest project, or index, is crucial to the whole expression of the item, ignore other and various coefficients and constants of

Such as 2 ^ n + n ^ 8 only see 2 ^ n, after all, the exponential growth faster than n how much power of the growth, complexity is O (2 ^ n)
ok, thanks, basic understand

CodePudding user response:

Obviously, while n - 1 other bits and pieces, is O (n)
Give points!

CodePudding user response:

refer to 7th floor cool99781 response:
is clearly, while n - 1 time other bits and pieces, is O (n)
Give points
zha to points ah, I revise my left this software

CodePudding user response:

refer to 7th floor cool99781 response:
is clearly, while n - 1 time other bits and pieces, is O (n)
Give points
and HXD has helped me in front of the hey hey
  • Related