190 likes | 506 Views
Algorithm Analysis (Time complexity). Software development cycle Four phases: Analysis Design Design an algorithm to solve the problem or sub- problem. Algorithm is s tep by step problem-solving process, and solution obtained in finite amount of time. Implementation
E N D
Software development cycle • Four phases: • Analysis • 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. • Implementation • Testing and Debugging
Algorithm Analysis: The Big-O Notation (cont’d.) • By analyzing a particular algorithm, we usually count the number of Primitive Operations: • Assigning a value to a variable • Calling a function • Performing an arithmetic operation • Comparing two values • 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 + 5 • We 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