lec0418 - CS 173 Discrete Mathematical Structures Cinda...

Info icon This preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 173: Discrete Mathematical Structures Cinda Heeren [email protected] Siebel Center, rm 2213 Office Hours: BY APPOINTMENT
Image of page 1

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

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

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

View Full Document Right Arrow Icon
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. We don’t have simple recipes for solving these  in all cases, though sometimes we do… f(n) a f(n/b) a f(n/b) a f(n/b) a f(n/b) a f(n/b 2 ) a f(n/b 2 ) f(n/b 2 ) Total running time is sum of the values in the  pink rectangles.
Image of page 4
Cs173 - Spring 2004 CS 173 Divide and Conquer Recurrences General form: T(n) = aT(n/b) + f(n) f(n) a f(n/b) a f(n/b) a f(n/b) a f(n/b) a f(n/b 2 ) a f(n/b 2 ) f(n/b 2 ) Sum over levels… How many? a) n b) b c) log b n d) no clue    ι=0 λογ β ν
Image of page 5

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

View Full Document Right Arrow Icon
Cs173 - Spring 2004 CS 173 Divide and Conquer Recurrences General form: T(n) = aT(n/b) + f(n) f(n) a f(n/b) a f(n/b) a f(n/b) a f(n/b) a f(n/b 2 ) a f(n/b 2 ) f(n/b 2 ) How many blocks at level  i? a) a b) a i c) i∙a d) no clue    ι=0 λογ β ν    α ι φ (?)
Image of page 6
Cs173 - Spring 2004 CS 173 Divide and Conquer Recurrences General form: T(n) = aT(n/b) + f(n) f(n) a f(n/b) a f(n/b) a f(n/b) a f(n/b) a f(n/b 2 ) a f(n/b 2 ) f(n/b 2 ) ? a) n/b i b) n log b c) i∙b d) no clue    ι=0 λογ β ν    α ι φ (?)    α ι φ ( n b i )
Image of page 7

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

View Full Document Right Arrow Icon
Cs173 - Spring 2004 CS 173 Divide and Conquer Recurrences General form: T(n) = aT(n/b) + f(n)    ι=0 λογ β ν    α ι φ ( n b i ) We no longer have recursive terms, but  we do have a sum to deal with. Consider binary search, and write a recurrence for the # of  comparisons:  T(n) = T(n/2) + 1 a = 1, b = 2, f(n) = 1.
Image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern