Answer to Question #259260 in Algorithms for anju

Question #259260

Explain empirical and theoretical approach for estimating time complexity.




1
Expert's answer
2021-10-31T12:07:13-0400

For a theoretical study of the algorithm complexity, it is necessary to calculate the number of operations performed and determine the dependence of this number on the input data size. Because the complexity is determined only up to a factor, then it will be sufficient only to determine how many times the innermost loop is iterated, and how this number is changed with changing data size.


To experimentally investigate the complexity of an algorithm, it is necessary to measure the execution time for different sizes of data sets. These measurements must be carried out for several data sets in order to exclude the influence of external factors as far as the influence of the data quality itself (favorable and unfavorable data for the algorithm) on the measurement results. After that, a graph of the dependence of the execution time on the size of the data is plotted (usually on a logarithmic scale) and the asymptotic complexity of the algorithm may be determined from the slope of this graph.



Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS