algorithm analysis (time complexity)
Post on 03-Jan-2016
44 Views
Preview:
DESCRIPTION
TRANSCRIPT
Algorithm Analysis (Time complexity)
Software development cycle
-Four phases:1. Analysis 2. Design
Design an algorithm to solve the problem or sub- problem. Algorithm is step by step problem-solving process, and solution obtained in finite amount of time.
3. Implementation4. Testing and Debugging
Algorithm Analysis: The Big-O Notation (cont’d.)
- By analyzing a particular algorithm, we usually count the number of Primitive Operations:
1. Assigning a value to a variable2.Calling a function3.Performing an arithmetic operation4.Comparing two values5.Returning from a function
The Big-O Notation (cont’d.)
- The following table shows each of the seven common functions used in algorithm analysis in order of growth rates.
Examples:
1- F(n) = 5n2 + 3n log n + 2n + 5We say the function F(n) is O(n2) or Big-O of n2
2- F(n)= 3 log n + 2 We say the function F(n) is O(log n) or Big-O of log n
3- F(n)= 2n + 100 log n We say the function F(n) is O(n) or Big-O of n
constant logarithm linear n-log-n quadratic cubic exponential
1 log n n n log n n2 n3 an, a>1
top related