# Day5 - Computational Complexity Computational Complexity Algorithm Analysis Algorithm a clearly specified set of instructions that the computer

This preview shows pages 1–3. Sign up to view the full content.

Algorithm Analysis Algorithm - a clearly specified set of instructions that the computer will follow to solve a problem. Algorithm Analysis - determining the amount of resources that the algorithm will require, typically in terms of time and space. Areas of study include: Estimation techniques for determining the running time of an algorithm. Techniques to reduce the running time of an algorithm. Mathematical framework for the accurate determination of the running time of an algorithm. Algorithm Analysis The running time of an algorithm is a function of the size of the input. Example: It takes longer to sort 1000 numbers than it does to sort 10 numbers. The value of this function depends upon many things including: 1. The speed of the host computer. 2. The size of the host computer. 3. The compilation process (quality of the compiler generated code). 4. The quality of the original source code which implements the algorithm. Illustration of running time vs input size for small input sets (corrected Figure 5.1) linear N log N quadratic time cubic constant N 1 Computational Complexity

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
When comparing two functions F(N) and G(N), it does not make sense to state that: F < G, F = G, or G < F. Example: At some point x , F may be smaller than G, yet at some other point y , F may be equal to or greater than G. Instead, the growth rates of the functions need to be determined. Definitions (based on the growth rate of the function): 1. constant function – function whose dominant term is a constant (c) 2. logarithmic func. – dominant term is log N 3. log-squared func. – dominant term is log 2 N 4. linear func. – dominant term is N 5. N log N func. – dominant term is N log N 6. quadratic func. – dominant term is N 2 7. cubic func. – dominant term is N 3 8. exponential func. – dominant term is 2 N There is a three-fold reason for basing our analysis on the growth rate of the function rather than its specific value at some point: 1. For sufficiently large values of N, the value of the function is primarily determined by its dominant term (sufficiently large varies by function). Example: Consider the cubic function where the function is expressed by 15N 3 + 20N 2 - 10N + 4. For large values of N, say 1000, the value of this function is: 15,019,990,004 of which 15,000,000,000 is due entirely to the N 3 term. Using only the N 3 term to estimate the value of this function introduces an error of only 0.1% which is typically close enough for estimation purposes. 2. Constants associated with the dominant term are usually not meaningful across different machines (maybe though for identically growing functions). 3. Small values of N are generally not important. Big-Oh Notation Used to represent the growth rate of a function. Allows algorithm designers to establish a relative order among functions by comparison of their dominant terms.
This is the end of the preview. Sign up to access the rest of the document.

## This document was uploaded on 06/12/2011.

### Page1 / 13

Day5 - Computational Complexity Computational Complexity Algorithm Analysis Algorithm a clearly specified set of instructions that the computer

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online