{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

lecture_02

# lecture_02 - Divide and Conquer Week 1 Reading Examples...

This preview shows pages 1–5. Sign up to view the full content.

1 Divide and Conquer Examples • Mergesort O(n log n) time • Long integer multiplication O(n log n) time • Finding the closest pair of points O(n log n) time • Matrix mulitplication O(n 2.81 ) time • Median O(n) time Week 1 Reading • Dasgupta 2.1-2.5 • Cormen 28.2, 33.4

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

View Full Document
Matrix multipliation Matrix multiplication: Let A and B be two n x n matrices of integers. Compute C = AB. Note that C[i, j] = 1 k n A[i,k] B[k,j]. C can be computed using O(n 3 ) integer operations (additions /multiplications). For i = 1 to n For j = 1 to n C[i,j] = A[i,1] x B[1,j] For k to 2 to n C[i,j] = C[i,j] + A[i, k ] x B[ k ,j]
Matrix multipliation Matrix multiplication: Let A and B be two n x n matrices of integers. Compute C = AB. Note that C[i, j] = 1 k n A[i,k] B[k,j]. Let us try divide and conquer. Assume n is a power of 2. A 11 A 21 A 12 A 22 B 11 B 21 B 12 B 22 C 11 C 21 C 12 C 22 A B = C

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

View Full Document
C 11 = A 11 B 11 + A 12 B 21 C 12 = A 11 B 12 + A 12 B 22 C 21 = A 21 B
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 14

lecture_02 - Divide and Conquer Week 1 Reading Examples...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online