Intro to Computer Algorithms Lecture 11 Phillip G. Bradford Computer Science University of Alabama.
-
Upload
piers-nichols -
Category
Documents
-
view
214 -
download
1
Transcript of Intro to Computer Algorithms Lecture 11 Phillip G. Bradford Computer Science University of Alabama.
![Page 1: Intro to Computer Algorithms Lecture 11 Phillip G. Bradford Computer Science University of Alabama.](https://reader036.fdocuments.us/reader036/viewer/2022071807/56649eb25503460f94bb8e11/html5/thumbnails/1.jpg)
Intro to Computer Algorithms Lecture 11
Phillip G. BradfordComputer Science
University of Alabama
![Page 2: Intro to Computer Algorithms Lecture 11 Phillip G. Bradford Computer Science University of Alabama.](https://reader036.fdocuments.us/reader036/viewer/2022071807/56649eb25503460f94bb8e11/html5/thumbnails/2.jpg)
Announcements
Advisory Board’s Industrial Talk Series http://www.cs.ua.edu/9IndustrialSeries.shtm
Coop Interview Days: Oct 14th and 15th Signup begins on 22nd of September At least 40 firms looking for coop
students!
![Page 3: Intro to Computer Algorithms Lecture 11 Phillip G. Bradford Computer Science University of Alabama.](https://reader036.fdocuments.us/reader036/viewer/2022071807/56649eb25503460f94bb8e11/html5/thumbnails/3.jpg)
Outline
Go over HW 4 More Divide-and-Conquer &
Analysis Exam Review
![Page 4: Intro to Computer Algorithms Lecture 11 Phillip G. Bradford Computer Science University of Alabama.](https://reader036.fdocuments.us/reader036/viewer/2022071807/56649eb25503460f94bb8e11/html5/thumbnails/4.jpg)
First Midterm Exam
I expect a good deal of preparation by my class
Thursday 9-October Closed Book & Closed Notes Start with your home works Text book Notes
![Page 5: Intro to Computer Algorithms Lecture 11 Phillip G. Bradford Computer Science University of Alabama.](https://reader036.fdocuments.us/reader036/viewer/2022071807/56649eb25503460f94bb8e11/html5/thumbnails/5.jpg)
The week of 6-Oct
I will be in Taiwan and Hong Kong doing research
Prof. Borie will give Lectures in my absence!
![Page 6: Intro to Computer Algorithms Lecture 11 Phillip G. Bradford Computer Science University of Alabama.](https://reader036.fdocuments.us/reader036/viewer/2022071807/56649eb25503460f94bb8e11/html5/thumbnails/6.jpg)
Back to the Closest Pair Problem
N points, then (N choose 2) pairs Compute the distance between
each possible pair and Find the minimum of this list of O(N2)
distances Total cost: O(N2) Can we do better?
![Page 7: Intro to Computer Algorithms Lecture 11 Phillip G. Bradford Computer Science University of Alabama.](https://reader036.fdocuments.us/reader036/viewer/2022071807/56649eb25503460f94bb8e11/html5/thumbnails/7.jpg)
The Closest Pair Problem
How about divide-and-conquer on the x-coordinate? Then the y-coordinate? What’s wrong with this?
Splitting the set gives a large cost for re-merging
Sort by x-coordinate and recursively by y-coordinate
![Page 8: Intro to Computer Algorithms Lecture 11 Phillip G. Bradford Computer Science University of Alabama.](https://reader036.fdocuments.us/reader036/viewer/2022071807/56649eb25503460f94bb8e11/html5/thumbnails/8.jpg)
The Closest Pair Problem
d1
d2
d d
![Page 9: Intro to Computer Algorithms Lecture 11 Phillip G. Bradford Computer Science University of Alabama.](https://reader036.fdocuments.us/reader036/viewer/2022071807/56649eb25503460f94bb8e11/html5/thumbnails/9.jpg)
The Closest Pair Problem
The 6 points principle
P
d
d
d
d
![Page 10: Intro to Computer Algorithms Lecture 11 Phillip G. Bradford Computer Science University of Alabama.](https://reader036.fdocuments.us/reader036/viewer/2022071807/56649eb25503460f94bb8e11/html5/thumbnails/10.jpg)
The Closest Pair Problem
Cost? O(N log N) per dimension T(N) = 2T(N/2) + cN Master Theorem: T(N) = O(N log
N).
![Page 11: Intro to Computer Algorithms Lecture 11 Phillip G. Bradford Computer Science University of Alabama.](https://reader036.fdocuments.us/reader036/viewer/2022071807/56649eb25503460f94bb8e11/html5/thumbnails/11.jpg)
Exam Review Solving Recurrences
Unwinding: Formality expected by induction
Master Theorem: give a, b and d. Designing & Analyzing Exhaustive
Sear or Brute Force Algorithms Designing & Analyzing Divide and
Conquer Algorithms