{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# Lecture12 - CSE 421 Algorithms Richard Anderson Lecture 12...

This preview shows pages 1–17. Sign up to view the full content.

CSE 421 Algorithms Richard Anderson Lecture 12 Recurrences and Divide and Conquer

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

View Full Document
Divide and Conquer
Recurrence Examples T(n) = 2 T(n/2) + cn O(n log n) T(n) = T(n/2) + cn O(n) More useful facts: – log k n = log 2 n / log 2 k k log n = n log k

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

View Full Document
T(n) = aT(n/b) + f(n)
Recursive Matrix Multiplication Multiply 2 x 2 Matrices: | r s | | a b| |e g| | t u| | c d| | f h| r = ae + bf s = ag + bh t = ce + df u = cg + dh A N x N matrix can be viewed as a 2 x 2 matrix with entries that are (N/2) x (N/2) matrices. The recursive matrix multiplication algorithm recursively multiplies the (N/2) x (N/2) matrices and combines them using the equations for multiplying 2 x 2 matrices =

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

View Full Document
Recursive Matrix Multiplication How many recursive calls are made at each level? How much work in combining the results? What is the recurrence?
What is the run time for the recursive Matrix Multiplication Algorithm? Recurrence:

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

View Full Document
T(n) = 4T(n/2) + cn
T(n) = 2T(n/2) + n 2

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

View Full Document
T(n) = 2T(n/2) + n 1/2
Recurrences Three basic behaviors Dominated by initial case Dominated by base case All cases equal – we care about the depth

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

View Full Document

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

View Full Document

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern