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

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

View Full Document Right Arrow Icon
CS 173: Discrete Mathematical Structures Cinda Heeren heeren@cs.uiuc.edu Siebel Center, rm 2213 Office Hours: BY APPOINTMENT
Background image of page 1

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

View Full DocumentRight Arrow Icon
Cs173 - Spring 2004 CS 173 Announcements Hwk #10 available, due 4/16, 8a Final Exam:  5/10, 7-10p, Siebel 1404
Background image of page 2
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.
Background image of page 3

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

View Full DocumentRight Arrow Icon
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  = 
Background image of page 4
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?
Background image of page 5

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

View Full DocumentRight Arrow Icon
Cs173 - Spring 2004 CS 173 Recurrences b i = 2β ι -1 + 2 , β 0 = 0
Background image of page 6
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?
Background image of page 7

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

View Full DocumentRight Arrow Icon
Cs173 - Spring 2004 CS 173 Recurrences
Background image of page 8
Cs173 - Spring 2004 CS 173 Recurrences
Background image of page 9

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

View Full DocumentRight Arrow Icon
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.
Background image of page 10
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.
Background image of page 11

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

View Full DocumentRight Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

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 Right Arrow Icon
Ask a homework question - tutors are online