Appendix B - Complexity of Algorithms
Published online by Cambridge University Press: 05 June 2012
Summary
Two resources coveted by software developers are memory space and execution time. Among the factors that determine the memory footprint of an application or its execution time is the algorithm chosen in the application (there may of course be many algorithms used within an application).
The space taken by an algorithm is related to the information structure used to hold the data and any other information structures required to support the computational process. These are usually defined as fields in the data structure class.
The time required to execute an algorithm is dependent on the structure of the algorithm. We are usually concerned with the worst-case time, the best-case time, and the average time, to be defined in the following paragraphs. Sometimes these are the same. These execution times are usually related to one or more parameters that determine the size of the problem being solved. To be conservative we normally rely on worst-case time when comparing two algorithms.
The worst-case time is the longest time that any problem of specified size takes to execute. The best-case time is the shortest time that any problem of specified size takes to execute. The average-case time is an estimate of the time required for an average problem of specified size.
For worst-case, best-case, and average-case times, we are normally concerned with asymptotic time complexity – in plain English, the time required to complete an algorithm as a function of problem size when the problem size is assumed to be large.
- Type
- Chapter
- Information
- Fundamentals of OOP and Data Structures in Java , pp. 445 - 449Publisher: Cambridge University PressPrint publication year: 2000