Week 8

Chapter Scores

  • Readability Score: 4 / 10
  • Interest Score: 7 / 10

Readings

Chapter 5: Divide and Conquer

5.3: Counting Inversions

5.4: Finding the Closest Pair of Points

Problem: Given n points on an X,Y coordinate plane, find the two points that are the smallest distance away from each other than to any other two points.

The initial solution to this problem is obvious:

This algorithm, however, is inefficient because it is . An optimization can be found with a divide and conquer algorithm in which we divide the plane in half and recursively find the closest pair of points. In this algorithm, a problem with boundary cases of points near the dividing line quickly arises but is squelched when we realize that points beyond a distance of half of the smallest distance so far don't have to be examined.

5.5: Integer Multiplication

Problem: Given an n-digit number A and an n-digit number B, find the product A x B.

The initial solution to this problem is obvious:

Naturally, this algorithm is inefficient because its nested for loop makes it . By using a divide and conquer algorithm, we can divide up the problem and remove unnecessary operations to discover an algorithm that is .

You could leave a comment if you were logged in.
courses/cs211/winter2012/journals/garrett/entries/week_8.txt · Last modified: 2012/03/14 03:27 by garrettheath4
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0