Lecture 30 CSE 331 Nov 8, 2013. HW 7 due today Place Q1, Q2 and Q3 in separate piles I will not accept HWs after 1:15pm DO NOT FORGET TO WRITE DOWN YOUR.

Slides:



Advertisements
Similar presentations
Lecture 20 CSE 331 Oct 10, HW 5 due today Place Q1, Q2 and Q3 in separate piles I will not accept HWs after 1:15pm.
Advertisements

Lecture 30 CSE 331 Nov 13, To be strictly enforced For the rest of the semester on Fridays SUBMIT your HOMEWORKS by 1:10 PM.
Lecture 38 CSE 331 Dec 7, The last few days Today: Solutions to HW 9 (end of lecture) Wednesday: Graded HW 9 (?), Sample final, Blog post on the.
Lecture 37 CSE 331 Nov 4, Homework stuff (Last!) HW 10 at the end of the lecture Solutions to HW 9 on Monday Graded HW 9 on.
Lecture 28 CSE 331 Nov 9, Flu and HW 6 Graded HW 6 at the END of the lecture If you have the flu, please stay home Contact me BEFORE you miss a.
Divide-and-Conquer1 7 2  9 4   2  2 79  4   72  29  94  4.
Lecture 32 CSE 331 Nov 18, HW 8 solutions Friday.
Lecture 31 CSE 331 Nov 16, Jeff is out of town this week No regular recitation or Jeff’s normal office hours I’ll hold extra Question sessions Mon,
Lecture 34 CSE 331 Nov 19, HW 9 due today Q1 in one pile and Q 2+3 in another I will not take any HW after 1:15pm.
Lecture 33 CSE 331 Nov 20, Homeworks Submit HW 9 by 1:10PM HW 8 solutions at the end of the lecture.
Lecture 38 CSE 331 Dec 3, A new grading proposal Towards your final score in the course MAX ( mid-term as 25%+ finals as 40%, finals as 65%) .
Lecture 34 CSE 331 Nov 30, Graded HW 8 On Wednesday.
Lecture 32 CSE 331 Nov 15, Feedback Forms Link for the survey on the blog.
Lecture 34 CSE 331 Nov 23, Homework related stuff Graded HW 8+9, solutions to HW 9 the week after Thanksgiving.
Lecture 33 CSE 331 Nov 17, Online office hours Alex will host the office hours.
Lecture 25 CSE 331 Nov 2, Adding teeth to group talk Form groups of size at most six (6) Pick a group leader I will ask group leader(s) to come.
Lecture 28 CSE 331 Nov 5, HW 7 due today Q1 in one pile and Q 2+3 in another I will not take any HW after 1:15pm.
Lecture 30 CSE 331 Nov 10, Online Office Hours
Lecture 29 CSE 331 Nov 11, To be strictly enforced For the rest of the semester on Fridays SUBMIT your HOMEWORKS by 1:10 PM.
Lecture 8 CSE 331 Sep 17, HW 1 due today Place Q1 and Q2 in separate piles I will not accept HWs after 1:15pm.
Divide-and-Conquer 7 2  9 4   2   4   7
Lecture 28 CSE 331 Nov 9, Mini project report due WED.
CSE 421 Algorithms Lecture 15 Closest Pair, Multiplication.
Lecture 18 CSE 331 Oct 12, HW 5 due today Q1, Q2 and Q3 in different piles I will not take any HW after 1:15pm.
Lecture 33 CSE 331 Nov 20, HW 8 due today Place Q1, Q2 and Q3 in separate piles I will not accept HWs after 1:15pm Submit your HWs to the side of.
Lecture 32 CSE 331 Nov 16, 2016.
Lecture 17 CSE 331 Oct 3, 2014.
Lecture 31 CSE 331 Nov 13, 2017.
Punya Biswas Lecture 15 Closest Pair, Multiplication
Lecture 8 CSE 331 Sep 12, 2014.
Lecture 14 CSE 331 Sep 30, 2011.
Lecture 30 CSE 331 Nov 11, 2016.
Lecture 26 CSE 331 Nov 1, 2017.
Divide-and-Conquer 7 2  9 4   2   4   7
Lecture 27 CSE 331 Nov 3, 2017.
Lecture 26 CSE 331 Nov 2, 2012.
Lecture 32 CSE 331 Nov 14, 2011.
Lecture 29 CSE 331 Nov 8, 2017.
Lecture 28 CSE 331 Nov 7, 2016.
CSE 2010: Algorithms and Data Structures
Lecture 32 CSE 331 Nov 15, 2017.
Lecture 33 CSE 331 Nov 14, 2014.
Lecture 30 CSE 331 Nov 10, 2017.
Lecture 27 CSE 331 Oct 31, 2014.
Lecture 33 CSE 331 Nov 15, 2013.
Lecture 34 CSE 331 Nov 18, 2011.
Lecture 28 CSE 331 Nov 7, 2012.
Lecture 27 CSE 331 Nov 2, 2010.
Lecture 31 CSE 331 Nov 14, 2012.
Lecture 31 CSE 331 Nov 12, 2010.
Divide-and-Conquer 7 2  9 4   2   4   7
Lecture 10 CSE 331 Sep 21, 2012.
Lecture 24 CSE 331 Oct 24, 2014.
Lecture 36 CSE 331 Nov 30, 2012.
Lecture 8 CSE 331 Sep 15, 2011.
Lecture 30 CSE 331 Nov 12, 2012.
Lecture 15, Winter 2019 Closest Pair, Multiplication
Richard Anderson Lecture 14 Divide and Conquer
Lecture 31 CSE 331 Nov 11, 2011.
Lecture 30 CSE 331 Nov 9, 2011.
Lecture 32 CSE 331 Nov 12, 2014.
Richard Anderson Lecture 14, Winter 2019 Divide and Conquer
Richard Anderson Lecture 14 Divide and Conquer
Divide-and-Conquer 7 2  9 4   2   4   7
Lecture 15 Closest Pair, Multiplication
Richard Anderson Lecture 12, Winter 2019 Recurrences
Lecture 27 CSE 331 Nov 4, 2016.
Lecture 11 CSE 331 Sep 20, 2013.
Lecture 27 CSE 331 Nov 1, 2013.
Presentation transcript:

Lecture 30 CSE 331 Nov 8, 2013

HW 7 due today Place Q1, Q2 and Q3 in separate piles I will not accept HWs after 1:15pm DO NOT FORGET TO WRITE DOWN YOUR SOURCES

Related HW stuff HW 8 has been posted on piazza Solutions to HW 7 at the END of the lecture Can pick up graded HW 6 from Monday

Integer Multiplication Input: a = (a n-1,..,a 0 ) and b = (b n-1,…,b 0 ) Output: c = a x b a = 1101 b = 1001 c =

Some notation Dec(a) = Dec(a 1 )  2 [n/2] + Dec(a 0 ) a 1 = 11 and a 0 = 01 Dec(a) = a n-1  2 n-1 + a n-2  2 n-2 +…+ a 1  2+ a 0 a = 1101 Dec(a) = 13 a 1 = (a n-1,..,a [n/2] ) a 0 =(a [n/2]-1,…,a 0 ) Dec(a) = a n-1  2 n-1 +…+ a [n/2]  2 [n/2] +a [n/2]-1  2 [n/2]-1 +…+ a 0 = 2 [n/2]  (a n-1  2 n-[n/2]-1 +…+ a [n/2] ) + a [n/2]-1  2 [n/2]-1 +…+ a 0

The algorithm so far… Mult over n bits Multiplication over n/2 bit inputs Shift by O(n) bits Adding O(n) bit numbers T(n) ≤ 4T(n/2) + cn T(1) ≤ c T(n) is O(n 2 )

Today’s agenda Design a better Divide and Conquer Multiplication Algorithm

HW 7 due today Place Q1, Q2 and Q3 in separate piles I will not accept HWs after 1:15pm DO NOT FORGET TO WRITE DOWN YOUR SOURCES

The key identity

The final algorithm Input: a = (a n-1,..,a 0 ) and b = (b n-1,…,b 0 ) If n = 1 return a 0 b 0 a 1 = a n-1,…,a [n/2] and a 0 = a [n/2]-1,…, a 0 Compute b 1 and b 0 from b Mult (a, b) Let p = Mult (x, y), D = Mult (a 1, b 1 ), E = Mult (a 0, b 0 ) T(1) ≤ c T(n) ≤ 3T(n/2) + cn O(n log 3 ) = O(n 1.59 ) run time O(n log 3 ) = O(n 1.59 ) run time

(Old) Reading Assignment Sec 5.2 of [KT]

Rankings

How close are two rankings?

Rest of today’s agenda Formal problem: Counting inversions Divide and Conquer algorithm

Divide and Conquer Divide up the problem into at least two sub-problems Recursively solve the sub-problems “Patch up” the solutions to the sub-problems for the final solution Solve all sub-problems: Mergesort Solve some sub-problems: Multiplication Solve stronger sub-problems: Inversions