This preview shows pages 1–10. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Data Structures and Algorithm Analysis Instructor: Dr. Malek Mouhoub Computer Science Department University of Regina Fall 2010 CS340 Fall 2010 1 1. Algorithm Analysis 1. Algorithm Analysis 1.1 Mathematics Review 1.2 Introduction to Algorithm Analysis 1.3 Asymptotic notation and Growth of functions 1.4 Case Study 1.5 Data Structures and Algorithm Analysis CS340 Fall 2010 2 1.1 Mathematics Review 1.1 Mathematics Review Exponents X A X B = X A + B X A X B = X A B ( X A ) B = X AB X N + X N = 2 X N = X 2 N 2 N + 2 N = 2 N +1 CS340 Fall 2010 3 1.1 Mathematics Review Logarithms By default, logarithms used in this course are to the base 2. X A = B log X B = A log A B = log C B log C A , A, B, C > , A = 1 log AB = log A + log B ; A, B > log A/B = log A log B log ( A B ) = B log A log X < X X > log 1 = 0 , log 2 = 1 , log 1 , 024 = , log 1 , 048 , 576 = CS340 Fall 2010 4 1.1 Mathematics Review / Summations N i =1 a i = a 1 + a 2 + + a N lim N N i =1 a i = i =1 a i = a 1 + a 2 + (infinite sum) Linearity N i =1 ( ca i + db i ) = c N i =1 a i + d N i =1 b i N i =1 ( f ( i )) = ( N i =1 f ( i )) General algebraic manipulations : N i =1 f ( N ) = N f ( N ) N i = n f ( i ) = N i =1 f ( i ) n 1 i =1 f ( i ) CS340 Fall 2010 5 1.1 Mathematics Review / Summations Geometric series : N i =0 A i = A N +1 1 A 1 if < A < 1 then N i =0 A i 1 1 A Arithmetic series : N i =1 i = N ( N +1) 2 = N 2 + N 2 N 2 2 N i =1 i 2 = N ( N +1)(2 N +1) 6 N 3 3 N i =1 i k N k +1  k +1  k = 1 * if k = 1 then H N = N i =1 1 i log e N * error in approx : , 57721566 CS340 Fall 2010 6 1.1 Mathematics Review / Products Q N i =1 a i = a 1 a 2 a N log( Q N i =1 a i ) = N i =1 log a i CS340 Fall 2010 7 1.1 Mathematics Review Proving statements Proof by induction 1. Proving a base case : establishing that a theorem is true for some small values. 2. Inductive hypothesis : the theorem is assumed to be true for all cases up to some limit k . 3. Given this assumption, show that the theorem is true for k + 1 Proof by Counter example : find an example showing that the theorem is not true. Proof by Contradiction : Assuming that the theorem is false and showing that this assumption implies that some known property is false, and hence the original assumption was erroneous. CS340 Fall 2010 8 1.2 Introduction to algorithm analysis 1.2 Introduction to algorithm analysis Boss gives the following problem to Mr Dupont, a fresh hired BSc in computer science (to test him . . . or may be just for fun) : T (1) = 3 T (2) = 10 T ( n ) = 2 T ( n 1) T ( n 2) What is T (100) ?...
View Full
Document
 Fall '10
 Dr.Malek
 Data Structures

Click to edit the document details