Intro to Computer Algorithms Lecture 6 - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

Intro to Computer Algorithms Lecture 6

Description:

University of Alabama. Announcements. Colloquia on Monday 22-Sept ... Suppose f(n) is Q(nd) and d 0. Then T(n) is. Q(nd) if a bd. Q(nd log n) if a = bd ... – PowerPoint PPT presentation

Number of Views:43
Avg rating:3.0/5.0
Slides: 10
Provided by: pgb8
Category:

less

Transcript and Presenter's Notes

Title: Intro to Computer Algorithms Lecture 6


1
Intro to Computer Algorithms Lecture 6
  • Phillip G. Bradford
  • Computer Science
  • University of Alabama

2
Announcements
  • Colloquia on Monday 22-Sept
  • David M. Mount presents
  • Approximation Algorithms for Clustering
  • At 1100 in 108 Houser

3
Lecture Outline
  • Homework Assignment
  • Review last lecture
  • More on Recurrences
  • Exhaustive Search
  • Divide and Conquer

4
Reading
  • Up through Chapter 3
  • Start Chapter 4.

5
Exhaustive Search
  • Brute-Force String Matching
  • Elements in string n
  • Elements in search string m
  • Closest Point Problems
  • Traveling Salesperson
  • Knapsack Problem

6
More Recurrence Examples
  • T(n) 2T(n/2) 1
  • Solution?
  • How about
  • T(n) 2T(n/2) n
  • Assume n is a power of 2.

7
Divide and Conquer
  • Divide instance in to parts
  • Solve problem on the parts
  • Combine the solutions

8
The Master Theorem
  • T(n) aT(n/b) f(n)
  • M. Theorem. Suppose f(n) is Q(nd) and d gt 0. Then
    T(n) is
  • Q(nd) if a lt bd
  • Q(nd log n) if a bd
  • Q(nlogba) if a gt bd

9
Examples
  • Recall, T(n) 2T(n/2) 1
  • Here, f(n) 1 and a b 2 and d 0.
  • So, a gt bd
  • Giving T(n) is Q(nlogba) Q(n)
Write a Comment
User Comments (0)
About PowerShow.com