algorithm analysis (time complexity). software development cycle -four phases: 1.analysis 2.design...

Download Algorithm Analysis (Time complexity). Software development cycle -Four phases: 1.Analysis 2.Design Algorithm Design an algorithm to solve the problem

If you can't read please download the document

Upload: claud-rogers

Post on 18-Jan-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

Algorithm Analysis (Time complexity) Software development cycle -Four phases: 1.Analysis 2.Design Algorithm 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.Implementation 4.Testing and Debugging Algorithm Analysis: The Big-O Notation (contd.) Primitive Operations: -By analyzing a particular algorithm, we usually count the number of Primitive Operations: 1. Assigning a value to a variable 2.Calling a function 3.Performing an arithmetic operation 4.Comparing two values 5.Returning from a function The Big-O Notation (contd.) -The following table shows each of the seven common functions used in algorithm analysis in order of growth rates. Examples: 1- F(n) = 5n 2 + 3n log n + 2n + 5 We say the function F(n) is O(n 2 ) or Big-O of n 2 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 log n We say the function F(n) is O(n) or Big-O of n constantlogarithmlinearn-log-nquadraticcubicexponential 1log nnn log nn2n2 n3n3 a n, a>1