In dealing with the complexity of an algorithm, we do not worry about the absolute number of elementary operations (comparisons, additions, subtractions, and assignments) that need to be performed at...


In dealing with the complexity of an algorithm, we do not worry about the absolute number of elementary operations (comparisons, additions, subtractions, and assignments) that need to be performed at any step as long as the number does not depend on the size of the problem.


(a) Suppose the actual running times (in milliseconds) of two algorithms are given by the following equations:


Algorithm 1 time: 1000n2


Algorithm 2 time: 10-8
(2n)


What is the smallest value of n, the number of nodes in the network, for which the execution time of algorithm 2 exceeds the execution time of algorithm 1?


(b) If the number of nodes in the network is only 2 larger than the number found in part (a), what is the ratio of the execution times of the two algorithms?


(c) If the number of nodes in the network is 10 more than the number found in part (a), what is the ratio of the execution times of the two algorithms? How long does each algorithm take? Do you really want to wait for algorithm 2 to finish?



May 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here