Question: Suppose we have two different algorithms to solve a problem. Algorithm A requires 10n instructions to solve the problem. Algorithm B requires 2 in- structions

 Suppose we have two different algorithms to solve a problem. Algorithm
A requires 10n" instructions to solve the problem. Algorithm B requires 2"

Suppose we have two different algorithms to solve a problem. Algorithm A requires 10n" instructions to solve the problem. Algorithm B requires 2" in- structions to solve problem. Suppose you code up algorithm A and run it on a computer that can execute, say million instructions per second. Suppose yon code up algorithm B and run it on a computer that runs 1000 times faster than the other computer (i.e., this computer can execute billion instructions per second). Compare the running time of the two algorithms (on the respec- tive computers) for input sizes of n = - 20, n = 30, and n = 40. Express the running times in suitable units (such as seconds, minutes, hours, days or years). Assume that an year has ently 365 days. What is the conclusion that you can draw from your results. (10 Pts.)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!