Algorithm A performs 10n2 basic operations and algorithm B p


Algorithm A performs 10n^2 basic operations and algorithm B performs 300 In n basic operations. For what value of n does algorithm B start to show its better performance?

Solution

Answer:

A\'s Performance = 10n^2

B\'s Performance = 300logn

If we represent A\'s performance = g(n)

B\'s performance = f(n)

Now f(n) = O(g(n)

which means f(n) < = c*g(n)

   = > 300 logn < = 10n^2

Check the larger values of n 300logn will be always lesser than 10n^2 so 300logn of B performance is always better than 10n^2 of A.

 Algorithm A performs 10n^2 basic operations and algorithm B performs 300 In n basic operations. For what value of n does algorithm B start to show its better p

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site