Let's suppose that we have solved the same problem with 7 different algorithms with different complexity in the same computer in which 1 basic operation is executed 1ms(=10^-6s).Fill the table with the time of execution complexity n=10 n=10^3 n=10^6 Sqrt(n) 2n n^2 n^3 2^n n+5 @ just help me with one for example just with 10 ^3 for each complexity thank you
First, ms means milliseconds (10^-3 s) because m is the abbreviation for milli. The abbreviation for micro (10^-6) is the lowercase Greek letter mu, which looks like a lowercase u, so we typically use u to mean micro. So microseconds is "us".
The "complexity" column is the exact runtime for the algorithm in terms of n. They give you n, and a formula to calculate the runtime for each case. Once you get those numbers, those will be the runtime in terms of basic operations. And they give you a factor for converting between a number of operations and time. So, for the sqrt(n) case, with n=10^6, the number of operations will be sqrt(10^6) = 1000. That's 1000us, or 1ms.
that was my mistake in fact because that is micro seconds(10^-6)0... so the point is that i just need to replace n and turn them into microseconds for ex. for n=10^3 the column will be filled this way sqrt(10^3) 2*10^3 (10^3)^2 (10^3)^3 2^(10^3) 10^3+5 ...that's it?
Yes, but then you need to evaluate those expressions (they're now just numbers, not functions of some variable, so they can be evaluated to a number) to get a number of operations, then turn that in to microseconds.
Join our real-time social learning platform and learn together with your friends!