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 Document
Unformatted text preview: CS 312: Algorithm Analysis Lecture #7: Recurrence Relations a.k.a. Difference Slides by: Eric Ringger, with contributions from Mike Jones, Eric Mercer, Sean Warnick This work is licensed under a Creative Commons AttributionShare Alike 3.0 Unported License. Announcements § Thought! § HW #4 Due Today § Project #2 § Help Session – how’d it go? § Early: next Friday § Due: Monday 1/30 § Much more challenging than Project #1 Objectives § Analyze Recursive Algorithms, especially for Divide and Conquer, using Recurrence Relations § Also known as Difference Equations § Today: Special Type of RRs § Homogeneous § Linear § Constant Coefficients § Leading up to a proof of the Master Theorem Recall: Analysis Framework Given a problem, § Identify your platform’s elementary operations (sometimes implicit) § Formulate your solution as an algorithm § Define the measure of the input size § Measure time efficiency by counting the number of times an elementary operation is executed § Measure space efficiency by counting the number of memory units consumed by the algorithm § The efficiency of some algorithms may differ significantly for inputs of the same size. § Distinguish among worstcase, averagecase, and bestcase efficiencies. Choose one. § Plot efficiency vs. input size § Establish order of growth. Use asymptotic notation. n0 c1g(n) c2g(n) f(n) Where is the difficulty for Analyzing Recursive Functions? )) ( ( ) ( n g n f Θ = Nonrecursive Algorithms Example : Element Uniqueness Problem, check whether all elements in an array are distinct. function UniqueElements( A[0…n1]) for i=0 to n2 for j = i+1 to n1 if A[i]=A[j] return false return true • Define input size • Define elementary operation • Distinguish worstcase ∑ ∑ = + = = 2 1 1 1 ) ( n i n i j worst n C [ ] ∑ ∑ = = = + + = 2 2 ) 1 ( 1 ) 1 ( ) 1 ( n i n i i n i n ∑ ∑ = = = 2 2 ) 1 ( ) ( n i n i worst i n n C ∑ =...
View
Full
Document
This note was uploaded on 03/02/2012 for the course C S 312 taught by Professor Jones,m during the Winter '08 term at BYU.
 Winter '08
 Jones,M

Click to edit the document details