Algorithm - comparing performance -
Assume that I have 3 algiusither A, B and C, which process N records.
Algorithm A takes a 80n + 40 step algorithm B takes n ^ 2 + 30n step algorithm takes c 2 ^ n step The algorithm is the most efficient
i) 10 & lt; N & lt; 50 The way I solve this problem, it is to assume that the value is equal to the value I
i) Let n = 20
Therefore
algo A - 80 (20) + 40 = 1640 step algo B - 20 ^ 2 = 400 step algo C - 2 ^ 20 = 1048576 Step < / Code> That's why Algon B is most effective.
I am not sure if I have correctly evaluated the performance of 3 algorithms, because I am replacing it with a value rather than using Big O Notation?
Please give advice Thanks
Deals with Big O Notation N Which is arbitrarily grown, i.e. the calculation of the O (n) expression n - & gt; Must be for infinity N is given in your case, so the overall running time can be calculated properly, the way you did it.
Comments
Post a Comment