Lecture07-recurrencerels

Lecture07-recurrencerels - CS 312 Algorithm Analysis...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the 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 Attribution-Share 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 worst-case, average-case, and best-case 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…n-1]) for i=0 to n-2 for j = i+1 to n-1 if A[i]=A[j] return false return true • Define input size • Define elementary operation • Distinguish worst-case ∑ ∑- =- + = = 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.

Page1 / 44

Lecture07-recurrencerels - CS 312 Algorithm Analysis...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online