Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| courses:cs211:winter2011:journals:wendy:chapter5 [2011/03/09 13:35] โ [Section 4: Finding the Closest Pair of Points] shangw | courses:cs211:winter2011:journals:wendy:chapter5 [2011/03/14 00:52] (current) โ shangw | ||
|---|---|---|---|
| Line 37: | Line 37: | ||
| T(n)< | T(n)< | ||
| Readability is 8. | Readability is 8. | ||
| + | |||
| + | ===== Section 5: Integer Multiplication ===== | ||
| + | This section introduces another problem that uses the divide conquer algorithm--integer multiplication. | ||
| + | This seemingly straight forward problem actually takes O(n^2) if using brute-force algorithm. But we can improve the running time using divide and conquer method. | ||
| + | The first try is to divide the original problem into 4 subproblems: | ||
| + | xy=x1y1+(x1y0)2^n/ | ||
| + | However, the recurrence relationship T(n)< | ||
| + | xy=x1y1+(x1y1+x0y0+x1y0+x0y1-x1y1+x0y0)2^n/ | ||
| + | =x1y1+(p-x1y1-x0y0)2^n/ | ||
| + | where p=(x0+x1)(y0+y1). | ||
| + | Now the recurrence relationship is T(n)< | ||
| + | |||
| + | Readability is 7. | ||
| + | |||
