# lec0413 - CS 173 Discrete Mathematical Structures Cinda...

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

CS 173: Discrete Mathematical Structures Cinda Heeren [email protected] Siebel Center, rm 2213 Office Hours: BY APPOINTMENT

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

View Full Document
Cs173 - Spring 2004 CS 173 Announcements Hwk #10 available, due 4/16, 8a Final Exam:  5/10, 7-10p, Siebel 1404
Cs173 - Spring 2004 CS 173 Recurrences Solve a n  = 2a n/2  + n,  a 1  = 0. Mergesort # of comparisons Recurrences whose recursive terms are fractions of n are said to be  “Divide and Conquer” recurrences. We solve them by making a simplifying assumption, and then  changing them into something familiar.

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

View Full Document
Cs173 - Spring 2004 CS 173 Recurrences Solve a n  = 2a n/2  + n,  a 1  = 0. Mergesort # of comparisons Simplifying assumption…what do you wish were true about n in  this recurrence? Assume (for now) that n is a power of 2. So we have  a sequence indexed by 1, 2, 4, 8, 16, … Trick: create a new sequence indexed the way we want! Let b i  =
Cs173 - Spring 2004 CS 173 Recurrences Solve a n  = 2a n/2  + n,  a 1  = 0. Mergesort # of comparisons a 2 i = 2α 2 ι -1 + 2 2 0 = 0 Let  b i = α 2 b i = 2β -1 + 2 , β 0 = 0 Any comments?

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

View Full Document
Cs173 - Spring 2004 CS 173 Recurrences b i = 2β ι -1 + 2 , β 0 = 0
Cs173 - Spring 2004 CS 173 Recurrences Here’s one for you to try: a n  = 2a n/3  - a n/9  + (log 3 n) 2 , a 1 =1, a 3 =1. What do you wish to be true about n?

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

View Full Document
Cs173 - Spring 2004 CS 173 Recurrences
Cs173 - Spring 2004 CS 173 Recurrences

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

View Full Document
Cs173 - Spring 2004 CS 173 Divide and Conquer Recurrences General form: T(n) = aT(n/b) + f(n) What do the algorithms look like? Divide the problem into a subproblems of size n/b. Solve those subproblems (recursively). Conquer the solution in time f(n). We understand how abstract this is.  Some of  us think cs125 should be a prerequisite for  this course. The only algorithms you have as examples are  mergesort and binary search.
Cs173 - Spring 2004 CS 173 Divide and Conquer Recurrences General form: T(n) = aT(n/b) + f(n) To solve a problem of size n, we require time f(n), plus the time it takes to  solve a subproblems of size n/b.

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 ]}

### Page1 / 23

lec0413 - CS 173 Discrete Mathematical Structures Cinda...

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

View Full Document
Ask a homework question - tutors are online