Lecture 28 CSE 331 Nov 7, 2016.

Slides:



Advertisements
Similar presentations
A simple example finding the maximum of a set S of n numbers.
Advertisements

Lecture 30 CSE 331 Nov 8, 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.
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 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.
CSC 3323 Notes – Recurrence Relations Algorithm Analysis.
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.
CSC 2300 Data Structures & Algorithms January 30, 2007 Chapter 2. Algorithm Analysis.
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 30 CSE 331 Nov 10, Online Office Hours
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 5 Instructor: Paul Beame TA: Gidon Shavit.
Dynamic Programming Introduction to Algorithms Dynamic Programming CSE 680 Prof. Roger Crawfis.
Grade School Revisited: How To Multiply Two Numbers Great Theoretical Ideas In Computer Science S. Rudich V. Adamchik CS Spring 2006 Lecture 18March.
Arithmetic.
Divide-and-Conquer 7 2  9 4   2   4   7
MA/CSSE 473 Day 02 Some Numeric Algorithms and their Analysis.
1 CPSC 320: Intermediate Algorithm Design and Analysis July 21, 2014.
MA/CSSE 473 Day 02 Some Numeric Algorithms and their Analysis.
4/3/2003CSE More Math CSE Algorithms Euclidean Algorithm Divide and Conquer.
Lecture 28 CSE 331 Nov 9, Mini project report due WED.
CSE 421 Algorithms Lecture 15 Closest Pair, Multiplication.
Introduction to Algorithms
Advanced Algorithms Analysis and Design
Lecture 32 CSE 331 Nov 16, 2016.
Divide-and-Conquer 6/30/2018 9:16 AM
Lecture 31 CSE 331 Nov 14, 2016.
Lecture 26 CSE 331 Nov 2, 2016.
Lecture 3: Divide-and-conquer
CS 3343: Analysis of Algorithms
Lecture 31 CSE 331 Nov 13, 2017.
Lecture 34 CSE 331 Nov 26, 2012.
Growth Functions Algorithms Lecture 8
CS 3343: Analysis of Algorithms
Lecture 34 CSE 331 Nov 26, 2012.
Punya Biswas Lecture 15 Closest Pair, Multiplication
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.
CSE 373 Data Structures and Algorithms
Lecture 32 CSE 331 Nov 14, 2011.
Lecture 29 CSE 331 Nov 8, 2017.
Introduction to Algorithms
Lecture 32 CSE 331 Nov 15, 2017.
Lecture 33 CSE 331 Nov 14, 2014.
Lecture 30 CSE 331 Nov 10, 2017.
Lecture 33 CSE 331 Nov 15, 2013.
Lecture 34 CSE 331 Nov 18, 2011.
Lecture 28 CSE 331 Nov 7, 2012.
Lecture 31 CSE 331 Nov 14, 2012.
Divide-and-Conquer 7 2  9 4   2   4   7
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.
David Kauchak cs161 Summer 2009
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
Lecture 27 CSE 331 Nov 4, 2016.
Lecture 27 CSE 331 Nov 1, 2013.
Presentation transcript:

Lecture 28 CSE 331 Nov 7, 2016

Mini project video due next Mon

Anonymous feedback

Thanks for responses so far! Detailed response at the end of the week

Allowed Sources

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

Improvements on a smaller scale Greedy algorithms: exponential  poly time (Typical) Divide and Conquer: O(n2)  asymptotically smaller running time

Multiplying two numbers Given two numbers a and b in binary a=(an-1,..,a0) and b = (bn-1,…,b0) Elementary school algorithm is O(n2) Compute c = a x b

The current algorithm scheme Shift by O(n) bits Adding O(n) bit numbers Mult over n bits a  b = a1b1 22[n/2] + (a1b0+a0b1)2[n/2] + a0b0 Multiplication over n/2 bit inputs T(n) is O(n2) T(n) ≤ 4T(n/2) + cn T(1) ≤ c

The key identity a1b0+a0b1= (a1+a0)(b1+b0) - a1b1 - a0b0

The final algorithm Input: a = (an-1,..,a0) and b = (bn-1,…,b0) T(1) ≤ c Mult (a, b) If n = 1 return a0b0 T(n) ≤ 3T(n/2) + cn a1 = an-1,…,a[n/2] and a0 = a[n/2]-1,…, a0 Compute b1 and b0 from b O(nlog 3) = O(n1.59) run time x = a1 + a0 and y = b1 + b0 Let p = Mult (x, y), D = Mult (a1, b1), E = Mult (a0, b0) All green operations are O(n) time F = p - D - E return D  22[n/2] + F  2[n/2] + E a  b = a1b1 22[n/2] +( (a1+a0)(b1+b0) - a1b1 - a0b0 ) 2[n/2] + a0b0