Divide and Conquer: Polynomial Multiplication Version of October 1 / 7, 24201
|
|
- Leonard Walters
- 6 years ago
- Views:
Transcription
1 Divide and Conquer: Polynomial Multiplication Version of October 7, 2014 Divide and Conquer: Polynomial Multiplication Version of October 1 / 7, 24201
2 Outline Outline: Introduction The polynomial multiplication problem An O(n 2 ) brute force algorithm An O(n 2 ) first divide-and-conquer algorithm An improved divide-and-conquer algorithm Remarks Divide and Conquer: Polynomial Multiplication Version of October 2 / 7, 24201
3 Divide-and-Conquer Already saw some divide and conquer algorithms Divide Conquer Divide a given problem into a or more subproblems (ideally of approximately equal size n/b) Solve each subproblem (directly if small enough or recursively) a T (n/b) Combine Combine the solutions of the subproblems into a global solution f (n) Cost satisfies T(n) = at(n/b) + f(n). Divide and Conquer: Polynomial Multiplication Version of October 3 / 7, 24201
4 Divide and Conquer Examples Two major examples so far Maximum Contiguious Subarray Mergesort Both satisfied T (n) = 2T (n/2) + O(n) T (n) = O(n log n) Also saw Quicksort Divide and Conquer, but unequal size problems Divide and Conquer: Polynomial Multiplication Version of October 4 / 7, 24201
5 Divide and Conquer Analysis Main tool is the Master Theorem for soving recurrences of form where T (n) = at (n/b) + f (n) a 1 and b 1 are constants and f (n) is a (asymptotically) positive function. Note: Initial conditions T (1), T (2),... T (k) for some k. They don t contribute to asymptotic growth n/b could be either n/b or n/b Divide and Conquer: Polynomial Multiplication Version of October 5 / 7, 24201
6 The Master Theorem T(n) = at(n/b) + f(n), c = log b a If f (n) = Θ(n c ɛ ) for some ɛ > 0 then T (n) = θ(n c ) If T (n) = 4T (n/2) + n then T (n) = Θ(n 2 ) If T (n) = 3T (n/2) + n then T (n) = Θ(n log 2 3 ) = Θ(n ) If f (n) = Θ(n c ) then T (n) = Θ(n c log n) If T (n) = 2T (n/2) + n then T (n) = Θ(n log n) If f (n) = Θ(n c+ɛ ) for some ɛ > 0 and if af (n/b) df (n) for some d < 1 and large enough n then T (n) = O(f (n)) If T (n) = T (n/2) + n then T (n) = Θ(n) Divide and Conquer: Polynomial Multiplication Version of October 6 / 7, 24201
7 More Master Theorem There are many variations of the Master Theorem. Here s one... If T (n) = T (3n/4) + T (n/5) + n then T (n) = Θ(n) More generally, given constants α i > 0 with i α i < 1, if T (n) = n + k i=1 T (α in) then T (n) = Θ(n). Divide and Conquer: Polynomial Multiplication Version of October 7 / 7, 24201
8 Objective and Outline Outline: Introduction The polynomial multiplication problem An O(n 2 ) brute force algorithm An O(n 2 ) first divide-and-conquer algorithm An improved divide-and-conquer algorithm Remarks Divide and Conquer: Polynomial Multiplication Version of October 8 / 7, 24201
9 The Polynomial Multiplication Problem Definition (Polynomial Multiplication Problem) Given two polynomials Compute the product A(x)B(x) Example A(x) = a 0 + a 1 x + + a n x n B(x) = b 0 + b 1 x + + b m x m A(x) = 1 + 2x + 3x 2 B(x) = 3 + 2x + 2x 2 A(x)B(x) = 3 + 8x + 15x x 3 + 6x 4 Assume that the coefficients a i and b i are stored in arrays A[0... n] and B[0... m] Cost: number of scalar multiplications and additions Divide and Conquer: Polynomial Multiplication Version of October 9 / 7, 24201
10 What do we need to compute exactly? Define A(x) = n i=0 a ix i B(x) = m i=0 b ix i C(x) = A(x)B(x) = n+m k=0 c kx k Then c k = a i b j 0 i n, 0 j m, i+j=k for all 0 k m + n Definition The vector (c 0, c 1,..., c m+n ) is the convolution of the vectors (a 0, a 1,..., a n ) and (b 0, b 1,..., b m ) While polynomial multiplication is interesting, real goal is to calculate convolutions. Major subroutine in digital signal processing Divide and Conquer: Polynomial Multiplication Version of October 10 / 7, 24201
11 Objective and Outline Outline: Introduction The polynomial multiplication problem An O(n 2 ) brute force algorithm An O(n 2 ) first divide-and-conquer algorithm An improved divide-and-conquer algorithm Remarks Divide and Conquer: Polynomial Multiplication Version of October 11 / 7, 24201
12 Direct (Brute Force) Approach To ease analysis, assume n = m. A(x) = n i=0 a ix i and B(x) = n i=0 b ix i C(x) = A(x)B(x) = 2n k=0 c kx k with c k = a i b j, for all 0 k 2n 0 i,j n,i+j=k Direct approach: Compute all c k s using the formula above Total number of multiplications: Θ(n 2 ) Total number of additions: Θ(n 2 ) Complexity: Θ(n 2 ) Divide and Conquer: Polynomial Multiplication Version of October 12 / 7, 24201
13 Objective and Outline Outline: Introduction The polynomial multiplication problem An O(n 2 ) brute force algorithm An O(n 2 ) first divide-and-conquer algorithm An improved divide-and-conquer algorithm Remarks Divide and Conquer: Polynomial Multiplication Version of October 13 / 7, 24201
14 Divide-and-Conquer: Divide Assume n is a power of 2 Define A 0 (x) = a 0 + a 1 x + + a n 2 1 x n 2 1 A 1 (x) = a n n x + + a n x n 2 A(x) = A 0 (x) + A 1 (x)x n 2 Similarly, define B 0 (x) and B 1 (x) such that B(x) = B 0 (x) + B 1 (x)x n 2 A(x)B(x) = A 0 (x)b 0 (x)+a 0 (x)b 1 (x)x n 2 +A1 (x)b 0 (x)x n 2 +A1 (x)b 1 (x)x n The original problem (of size n) is divided into 4 problems of input size n/2 Divide and Conquer: Polynomial Multiplication Version of October 14 / 7, 24201
15 Example A(x) = 2 + 5x + 3x 2 + x 3 x 4 B(x) = 1 + 2x + 2x 2 + 3x 3 + 6x 4 A(x)B(x) = 2 + 9x + 17x x x x 5 +19x 6 + 3x 7 6x 8 A 0 (x) = 2 + 5x, A 1 (x) = 3 + x x 2, A(x) = A 0 (x) + A 1 (x)x 2 B 0 (x) = 1 + 2x, B 1 (x) = 2 + 3x + 6x 2, B(x) = B 0 (x) + B 1 (x)x 2 A 0 (x)b 0 (x) = 2 + 9x + 10x 2 A 1 (x)b 1 (x) = x + 19x 2 + 3x 3 6x 4 A 0 (x)b 1 (x) = x + 27x x 3 A 1 (x)b 0 (x) = 3 + 7x + x 2 2x 3 A 0 (x)b 1 (x) + A 1 (x)b 0 (x) = x + 28x x 3 A 0 (x)b 0 (x) + (A 0 (x)b 1 (x) + A 1 (x)b 0 (x))x 2 + A 1 (x)b 1 (x)x 4 = 2 + 9x + 17x x x x x 6 + 3x 7 6x 8 Divide and Conquer: Polynomial Multiplication Version of October 15 / 7, 24201
16 Divide-and-Conquer: Conquer Conquer: Solve the four subproblems compute A 0 (x)b 0 (x), A 0 (x)b 1 (x), A 1 (x)b 0 (x), A 1 (x)b 1 (x) by recursively calling the algorithm 4 times Combine adding the following four polynomials A 0 (x)b 0 (x)+a 0 (x)b 1 (x)x n 2 +A1 (x)b 0 (x)x n 2 +A1 (x)b 1 (x)x n takes O(n) operations (Why?) Divide and Conquer: Polynomial Multiplication Version of October 16 / 7, 24201
17 The First Divide-and-Conquer Algorithm PolyMulti1(A(x), B(x)) begin A 0 (x) = a 0 + a 1 x + + a n 2 1 x n 2 1 ; A 1 (x) = a n + a n x + + a n x n 2 ; B 0 (x) = b 0 + b 1 x + + b n 2 1 x n 2 1 ; B 1 (x) = b n + b n x + + b n x n 2 ; U(x) = PolyMulti1(A 0 (x), B 0 (x)); V (x) = PolyMulti1(A 0 (x), B 1 (x)); W (x) = PolyMulti1(A 1 (x), B 0 (x)); Z(x) = PolyMulti1(A 1 (x), B 1 (x)); return ( U(x) + [V (x) + W (x)]x n 2 + Z(x)x n) end Divide and Conquer: Polynomial Multiplication Version of October 17 / 7, 24201
18 Analysis of Running Time Assume that n is a power of 2 { 4T (n/2) + n, if n > 1, T (n) = 1, if n = 1. By the Master Theorem for recurrences T (n) = Θ(n 2 ). Same order as the brute force approach! No improvement! Divide and Conquer: Polynomial Multiplication Version of October 18 / 7, 24201
19 Objective and Outline Outline: Introduction The polynomial multiplication problem An O(n 2 ) brute force algorithm An O(n 2 ) first divide-and-conquer algorithm An improved divide-and-conquer algorithm Remarks Divide and Conquer: Polynomial Multiplication Version of October 19 / 7, 24201
20 Two Observations Observation 1: We said that we need the 4 terms: A 0 B 0, A 0 B 1, A 1 B 0, A 1 B. What we really need are the 3 terms: Observation 2: A 0 B 0, A 0 B 1 + A 1 B 0, A 1 B 1! The three terms can be obtained using only 3 multiplications: Y = (A 0 + A 1 )(B 0 + B 1 ) U = A 0 B 0 Z = A 1 B 1 We need U and Z and A 0 B 1 + A 1 B 0 = Y U Z Divide and Conquer: Polynomial Multiplication Version of October 20 / 7, 24201
21 The Second Divide-and-Conquer Algorithm PolyMulti2(A(x), B(x)) begin A 0 (x) = a 0 + a 1 x + + a n 2 1 x n 2 1 ; A 1 (x) = a n + a n x + + a n x n n 2 ; B 0 (x) = b 0 + b 1 x + + b n 2 1 x n 2 1 ; B 1 (x) = b n + b n x + + b n x n n 2 ; Y (x) = PolyMulti2(A 0 (x) + A 1 (x), B 0 (x) + B 1 (x)); U(x) = PolyMulti2(A 0 (x), B 0 (x)); Z(x) = PolyMulti2(A 1 (x), B 1 (x)); return ( ) U(x) + [Y (x) U(x) Z(x)]x n 2 + Z(x)x 2 n 2 end Divide and Conquer: Polynomial Multiplication Version of October 21 / 7, 24201
22 Running Time of the Modified Algorithm T (n) = { 3T (n/2) + n, if n > 1, 1, if n = 1. By the Master Theorem for recurrences T (n) = Θ(n log 2 3 ) = Θ(n ). Much better than previous Θ(n 2 ) algorithms! Divide and Conquer: Polynomial Multiplication Version of October 22 / 7, 24201
23 Objective and Outline Outline: Introduction The polynomial multiplication problem An O(n 2 ) brute force algorithm An O(n 2 ) first divide-and-conquer algorithm An improved divide-and-conquer algorithm Remarks Divide and Conquer: Polynomial Multiplication Version of October 23 / 7, 24201
24 Remarks This algorithm can also be used for (long) integer multiplication Really designed by Karatsuba (1960, 1962) for that purpose. Response to conjecture by Kolmogorov, founder of modern probability, that this would require Θ(n 2 ). Similar to technique deeloped by Strassen a few years later to multiply 2 n n matrices in O(n log 2 7 ) operations, instead of the Θ(n 3 ) that a straightforward algorithm would use. Takeaway from this lesson is that divide-and-conquer doesn t always give you faster algorithm. Sometimes, you need to be more clever. Coming up. An O(n log n) solution to the polynomial multiplication problem It involves strange recasting of the problem and solution using the Fast Fourier Transform algorithm as a subroutine The FFT is another classic D & C algorithm that we will learn soon. Divide and Conquer: Polynomial Multiplication Version of October 24 / 7, 24201
CPS 616 DIVIDE-AND-CONQUER 6-1
CPS 616 DIVIDE-AND-CONQUER 6-1 DIVIDE-AND-CONQUER Approach 1. Divide instance of problem into two or more smaller instances 2. Solve smaller instances recursively 3. Obtain solution to original (larger)
More informationCSE 421 Algorithms. T(n) = at(n/b) + n c. Closest Pair Problem. Divide and Conquer Algorithms. What you really need to know about recurrences
CSE 421 Algorithms Richard Anderson Lecture 13 Divide and Conquer What you really need to know about recurrences Work per level changes geometrically with the level Geometrically increasing (x > 1) The
More informationDivide and Conquer algorithms
Divide and Conquer algorithms Another general method for constructing algorithms is given by the Divide and Conquer strategy. We assume that we have a problem with input that can be split into parts in
More informationCS/COE 1501 cs.pitt.edu/~bill/1501/ Integer Multiplication
CS/COE 1501 cs.pitt.edu/~bill/1501/ Integer Multiplication Integer multiplication Say we have 5 baskets with 8 apples in each How do we determine how many apples we have? Count them all? That would take
More informationIntroduction to Algorithms 6.046J/18.401J/SMA5503
Introduction to Algorithms 6.046J/8.40J/SMA5503 Lecture 3 Prof. Piotr Indyk The divide-and-conquer design paradigm. Divide the problem (instance) into subproblems. 2. Conquer the subproblems by solving
More informationDivide and Conquer. Andreas Klappenecker. [based on slides by Prof. Welch]
Divide and Conquer Andreas Klappenecker [based on slides by Prof. Welch] Divide and Conquer Paradigm An important general technique for designing algorithms: divide problem into subproblems recursively
More informationAsymptotic Analysis and Recurrences
Appendix A Asymptotic Analysis and Recurrences A.1 Overview We discuss the notion of asymptotic analysis and introduce O, Ω, Θ, and o notation. We then turn to the topic of recurrences, discussing several
More informationFast Convolution; Strassen s Method
Fast Convolution; Strassen s Method 1 Fast Convolution reduction to subquadratic time polynomial evaluation at complex roots of unity interpolation via evaluation at complex roots of unity 2 The Master
More informationCMPS 2200 Fall Divide-and-Conquer. Carola Wenk. Slides courtesy of Charles Leiserson with changes and additions by Carola Wenk
CMPS 2200 Fall 2017 Divide-and-Conquer Carola Wenk Slides courtesy of Charles Leiserson with changes and additions by Carola Wenk 1 The divide-and-conquer design paradigm 1. Divide the problem (instance)
More informationChapter 4 Divide-and-Conquer
Chapter 4 Divide-and-Conquer 1 About this lecture (1) Recall the divide-and-conquer paradigm, which we used for merge sort: Divide the problem into a number of subproblems that are smaller instances of
More informationChapter 2. Recurrence Relations. Divide and Conquer. Divide and Conquer Strategy. Another Example: Merge Sort. Merge Sort Example. Merge Sort Example
Recurrence Relations Chapter 2 Divide and Conquer Equation or an inequality that describes a function by its values on smaller inputs. Recurrence relations arise when we analyze the running time of iterative
More informationCS 577 Introduction to Algorithms: Strassen s Algorithm and the Master Theorem
CS 577 Introduction to Algorithms: Jin-Yi Cai University of Wisconsin Madison In the last class, we described InsertionSort and showed that its worst-case running time is Θ(n 2 ). Check Figure 2.2 for
More informationChapter 1 Divide and Conquer Polynomial Multiplication Algorithm Theory WS 2015/16 Fabian Kuhn
Chapter 1 Divide and Conquer Polynomial Multiplication Algorithm Theory WS 2015/16 Fabian Kuhn Formulation of the D&C principle Divide-and-conquer method for solving a problem instance of size n: 1. Divide
More informationThe maximum-subarray problem. Given an array of integers, find a contiguous subarray with the maximum sum. Very naïve algorithm:
The maximum-subarray problem Given an array of integers, find a contiguous subarray with the maximum sum. Very naïve algorithm: Brute force algorithm: At best, θ(n 2 ) time complexity 129 Can we do divide
More informationA design paradigm. Divide and conquer: (When) does decomposing a problem into smaller parts help? 09/09/ EECS 3101
A design paradigm Divide and conquer: (When) does decomposing a problem into smaller parts help? 09/09/17 112 Multiplying complex numbers (from Jeff Edmonds slides) INPUT: Two pairs of integers, (a,b),
More informationDivide and Conquer. CSE21 Winter 2017, Day 9 (B00), Day 6 (A00) January 30,
Divide and Conquer CSE21 Winter 2017, Day 9 (B00), Day 6 (A00) January 30, 2017 http://vlsicad.ucsd.edu/courses/cse21-w17 Merging sorted lists: WHAT Given two sorted lists a 1 a 2 a 3 a k b 1 b 2 b 3 b
More informationAlgorithms, Design and Analysis. Order of growth. Table 2.1. Big-oh. Asymptotic growth rate. Types of formulas for basic operation count
Types of formulas for basic operation count Exact formula e.g., C(n) = n(n-1)/2 Algorithms, Design and Analysis Big-Oh analysis, Brute Force, Divide and conquer intro Formula indicating order of growth
More informationChapter 5 Divide and Conquer
CMPT 705: Design and Analysis of Algorithms Spring 008 Chapter 5 Divide and Conquer Lecturer: Binay Bhattacharya Scribe: Chris Nell 5.1 Introduction Given a problem P with input size n, P (n), we define
More informationCS483 Design and Analysis of Algorithms
CS483 Design and Analysis of Algorithms Lecture 6-8 Divide and Conquer Algorithms Instructor: Fei Li lifei@cs.gmu.edu with subject: CS483 Office hours: STII, Room 443, Friday 4:00pm - 6:00pm or by appointments
More informationRecurrence Relations
Recurrence Relations Analysis Tools S.V. N. (vishy) Vishwanathan University of California, Santa Cruz vishy@ucsc.edu January 15, 2016 S.V. N. Vishwanathan (UCSC) CMPS101 1 / 29 Recurrences Outline 1 Recurrences
More informationfeb abhi shelat Matrix, FFT
L7 feb 11 2016 abhi shelat Matrix, FFT userid: = Using the standard method, how many multiplications does it take to multiply two NxN matrices? cos( /4) = cos( /2) = sin( /4) = sin( /2) = Mergesort Karatsuba
More informationMA008/MIIZ01 Design and Analysis of Algorithms Lecture Notes 3
MA008 p.1/37 MA008/MIIZ01 Design and Analysis of Algorithms Lecture Notes 3 Dr. Markus Hagenbuchner markus@uow.edu.au. MA008 p.2/37 Exercise 1 (from LN 2) Asymptotic Notation When constants appear in exponents
More informationIntroduction to Algorithms
Lecture 1 Introduction to Algorithms 1.1 Overview The purpose of this lecture is to give a brief overview of the topic of Algorithms and the kind of thinking it involves: why we focus on the subjects that
More informationDivide and Conquer. Maximum/minimum. Median finding. CS125 Lecture 4 Fall 2016
CS125 Lecture 4 Fall 2016 Divide and Conquer We have seen one general paradigm for finding algorithms: the greedy approach. We now consider another general paradigm, known as divide and conquer. We have
More informationCMPSCI611: Three Divide-and-Conquer Examples Lecture 2
CMPSCI611: Three Divide-and-Conquer Examples Lecture 2 Last lecture we presented and analyzed Mergesort, a simple divide-and-conquer algorithm. We then stated and proved the Master Theorem, which gives
More informationDivide and conquer. Philip II of Macedon
Divide and conquer Philip II of Macedon Divide and conquer 1) Divide your problem into subproblems 2) Solve the subproblems recursively, that is, run the same algorithm on the subproblems (when the subproblems
More informationFFT: Fast Polynomial Multiplications
FFT: Fast Polynomial Multiplications Jie Wang University of Massachusetts Lowell Department of Computer Science J. Wang (UMass Lowell) FFT: Fast Polynomial Multiplications 1 / 20 Overview So far we have
More informationThe Divide-and-Conquer Design Paradigm
CS473- Algorithms I Lecture 4 The Divide-and-Conquer Design Paradigm CS473 Lecture 4 1 The Divide-and-Conquer Design Paradigm 1. Divide the problem (instance) into subproblems. 2. Conquer the subproblems
More informationCSE548, AMS542: Analysis of Algorithms, Fall 2017 Date: October 11. In-Class Midterm. ( 7:05 PM 8:20 PM : 75 Minutes )
CSE548, AMS542: Analysis of Algorithms, Fall 2017 Date: October 11 In-Class Midterm ( 7:05 PM 8:20 PM : 75 Minutes ) This exam will account for either 15% or 30% of your overall grade depending on your
More informationClass Note #14. In this class, we studied an algorithm for integer multiplication, which. 2 ) to θ(n
Class Note #14 Date: 03/01/2006 [Overall Information] In this class, we studied an algorithm for integer multiplication, which improved the running time from θ(n 2 ) to θ(n 1.59 ). We then used some of
More informationData Structures and Algorithms Chapter 3
Data Structures and Algorithms Chapter 3 1. Divide and conquer 2. Merge sort, repeated substitutions 3. Tiling 4. Recurrences Recurrences Running times of algorithms with recursive calls can be described
More informationThe divide-and-conquer strategy solves a problem by: 1. Breaking it into subproblems that are themselves smaller instances of the same type of problem
Chapter 2. Divide-and-conquer algorithms The divide-and-conquer strategy solves a problem by: 1. Breaking it into subproblems that are themselves smaller instances of the same type of problem. 2. Recursively
More informationAlgorithm Design and Analysis
Algorithm Design and Analysis LECTURE 9 Divide and Conquer Merge sort Counting Inversions Binary Search Exponentiation Solving Recurrences Recursion Tree Method Master Theorem Sofya Raskhodnikova S. Raskhodnikova;
More information1 Divide and Conquer (September 3)
The control of a large force is the same principle as the control of a few men: it is merely a question of dividing up their numbers. Sun Zi, The Art of War (c. 400 C.E.), translated by Lionel Giles (1910)
More informationAnalysis of Algorithms I: Asymptotic Notation, Induction, and MergeSort
Analysis of Algorithms I: Asymptotic Notation, Induction, and MergeSort Xi Chen Columbia University We continue with two more asymptotic notation: o( ) and ω( ). Let f (n) and g(n) are functions that map
More informationCS 470/570 Divide-and-Conquer. Format of Divide-and-Conquer algorithms: Master Recurrence Theorem (simpler version)
CS 470/570 Divide-and-Conquer Format of Divide-and-Conquer algorithms: Divide: Split the array or list into smaller pieces Conquer: Solve the same problem recursively on smaller pieces Combine: Build the
More informationCS483 Design and Analysis of Algorithms
CS483 Design and Analysis of Algorithms Chapter 2 Divide and Conquer Algorithms Instructor: Fei Li lifei@cs.gmu.edu with subject: CS483 Office hours: Room 5326, Engineering Building, Thursday 4:30pm -
More informationData Structures and Algorithms Chapter 3
1 Data Structures and Algorithms Chapter 3 Werner Nutt 2 Acknowledgments The course follows the book Introduction to Algorithms, by Cormen, Leiserson, Rivest and Stein, MIT Press [CLRST]. Many examples
More informationChapter 2. Divide-and-conquer. 2.1 Strassen s algorithm
Chapter 2 Divide-and-conquer This chapter revisits the divide-and-conquer paradigms and explains how to solve recurrences, in particular, with the use of the master theorem. We first illustrate the concept
More informationMatrices: 2.1 Operations with Matrices
Goals In this chapter and section we study matrix operations: Define matrix addition Define multiplication of matrix by a scalar, to be called scalar multiplication. Define multiplication of two matrices,
More informationMatrix Multiplication
Matrix Multiplication Matrix Multiplication Matrix multiplication. Given two n-by-n matrices A and B, compute C = AB. n c ij = a ik b kj k=1 c 11 c 12 c 1n c 21 c 22 c 2n c n1 c n2 c nn = a 11 a 12 a 1n
More informationOutline. 1 Introduction. Merging and MergeSort. 3 Analysis. 4 Reference
Outline Computer Science 331 Sort Mike Jacobson Department of Computer Science University of Calgary Lecture #25 1 Introduction 2 Merging and 3 4 Reference Mike Jacobson (University of Calgary) Computer
More informationDivide and Conquer. Chapter Overview. 1.2 Divide and Conquer
Chapter 1 Divide and Conquer 1.1 Overview This chapter introduces Divide and Conquer, which is a technique for designing recursive algorithms that are (sometimes) asymptotically efficient. It also presents
More informationDivide-and-Conquer Algorithms and Recurrence Relations. Niloufar Shafiei
Divide-and-Conquer Algorithms and Recurrence Relations Niloufar Shafiei Divide-and-conquer algorithms Divide-and-conquer algorithms: 1. Dividing the problem into smaller sub-problems 2. Solving those sub-problems
More informationCSE 421 Algorithms: Divide and Conquer
CSE 42 Algorithms: Divide and Conquer Larry Ruzzo Thanks to Richard Anderson, Paul Beame, Kevin Wayne for some slides Outline: General Idea algorithm design paradigms: divide and conquer Review of Merge
More informationV. Adamchik 1. Recurrences. Victor Adamchik Fall of 2005
V. Adamchi Recurrences Victor Adamchi Fall of 00 Plan Multiple roots. More on multiple roots. Inhomogeneous equations 3. Divide-and-conquer recurrences In the previous lecture we have showed that if the
More informationCOMP 382: Reasoning about algorithms
Fall 2014 Unit 4: Basics of complexity analysis Correctness and efficiency So far, we have talked about correctness and termination of algorithms What about efficiency? Running time of an algorithm For
More informationDivide and Conquer. Andreas Klappenecker
Divide and Conquer Andreas Klappenecker The Divide and Conquer Paradigm The divide and conquer paradigm is important general technique for designing algorithms. In general, it follows the steps: - divide
More informationDivide and Conquer. Arash Rafiey. 27 October, 2016
27 October, 2016 Divide the problem into a number of subproblems Divide the problem into a number of subproblems Conquer the subproblems by solving them recursively or if they are small, there must be
More informationCSE 548: Analysis of Algorithms. Lecture 4 ( Divide-and-Conquer Algorithms: Polynomial Multiplication )
CSE 548: Analysis of Algorithms Lecture 4 ( Divide-and-Conquer Algorithms: Polynomial Multiplication ) Rezaul A. Chowdhury Department of Computer Science SUNY Stony Brook Spring 2015 Coefficient Representation
More informationGrade 11/12 Math Circles Fall Nov. 5 Recurrences, Part 2
1 Faculty of Mathematics Waterloo, Ontario Centre for Education in Mathematics and Computing Grade 11/12 Math Circles Fall 2014 - Nov. 5 Recurrences, Part 2 Running time of algorithms In computer science,
More informationDivide-and-conquer: Order Statistics. Curs: Fall 2017
Divide-and-conquer: Order Statistics Curs: Fall 2017 The divide-and-conquer strategy. 1. Break the problem into smaller subproblems, 2. recursively solve each problem, 3. appropriately combine their answers.
More informationSolving Recurrences. Lecture 23 CS2110 Fall 2011
Solving Recurrences Lecture 23 CS2110 Fall 2011 1 Announcements Makeup Prelim 2 Monday 11/21 7:30-9pm Upson 5130 Please do not discuss the prelim with your classmates! Quiz 4 next Tuesday in class Topics:
More informationThe Fast Fourier Transform. Andreas Klappenecker
The Fast Fourier Transform Andreas Klappenecker Motivation There are few algorithms that had more impact on modern society than the fast Fourier transform and its relatives. The applications of the fast
More informationITEC2620 Introduction to Data Structures
ITEC2620 Introduction to Data Structures Lecture 6a Complexity Analysis Recursive Algorithms Complexity Analysis Determine how the processing time of an algorithm grows with input size What if the algorithm
More informationChapter 1 Divide and Conquer Algorithm Theory WS 2016/17 Fabian Kuhn
Chapter 1 Divide and Conquer Algorithm Theory WS 2016/17 Fabian Kuhn Formulation of the D&C principle Divide-and-conquer method for solving a problem instance of size n: 1. Divide n c: Solve the problem
More informationKartsuba s Algorithm and Linear Time Selection
CS 374: Algorithms & Models of Computation, Fall 2015 Kartsuba s Algorithm and Linear Time Selection Lecture 09 September 22, 2015 Chandra & Manoj (UIUC) CS374 1 Fall 2015 1 / 32 Part I Fast Multiplication
More informationInteger-Valued Polynomials
Integer-Valued Polynomials LA Math Circle High School II Dillon Zhi October 11, 2015 1 Introduction Some polynomials take integer values p(x) for all integers x. The obvious examples are the ones where
More informationChapter 5. Divide and Conquer CLRS 4.3. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.
Chapter 5 Divide and Conquer CLRS 4.3 Slides by Kevin Wayne. Copyright 25 Pearson-Addison Wesley. All rights reserved. Divide-and-Conquer Divide-and-conquer. Break up problem into several parts. Solve
More informationDIVIDE AND CONQUER II
DIVIDE AND CONQUER II master theorem integer multiplication matrix multiplication convolution and FFT Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley http://www.cs.princeton.edu/~wayne/kleinberg-tardos
More informationA SUMMARY OF RECURSION SOLVING TECHNIQUES
A SUMMARY OF RECURSION SOLVING TECHNIQUES KIMMO ERIKSSON, KTH These notes are meant to be a complement to the material on recursion solving techniques in the textbook Discrete Mathematics by Biggs. In
More informationSolving Quadratic Equations
Solving Quadratic Equations MATH 101 College Algebra J. Robert Buchanan Department of Mathematics Summer 2012 Objectives In this lesson we will learn to: solve quadratic equations by factoring, solve quadratic
More informationAnalysis of Algorithms - Using Asymptotic Bounds -
Analysis of Algorithms - Using Asymptotic Bounds - Andreas Ermedahl MRTC (Mälardalens Real-Time Research Center) andreas.ermedahl@mdh.se Autumn 004 Rehersal: Asymptotic bounds Gives running time bounds
More informationCSC373: Algorithm Design, Analysis and Complexity Fall 2017
CSC373: Algorithm Design, Analysis and Complexity Fall 2017 Allan Borodin (in collaboration with Rabia Bakhteri and with occasional guest lectures by Nisarg Shah and Denis Pankratov) September 13, 2017
More informationRecurrence Relations
Recurrence Relations Winter 2017 Recurrence Relations Recurrence Relations A recurrence relation for the sequence {a n } is an equation that expresses a n in terms of one or more of the previous terms
More informationDesign and Analysis of Algorithms
CSE 101, Winter 2018 Design and Analysis of Algorithms Lecture 4: Divide and Conquer (I) Class URL: http://vlsicad.ucsd.edu/courses/cse101-w18/ Divide and Conquer ( DQ ) First paradigm or framework DQ(S)
More informationHomework 1 Solutions
CS3510 Design & Analysis of Algorithms Section A Homework 1 Solutions Released 4pm Friday Sep 8, 2017 This homework has a total of 4 problems on 4 pages. Solutions should be submitted to GradeScope before
More informationDivide & Conquer. CS 320, Fall Dr. Geri Georg, Instructor CS320 Div&Conq 1
Divide & Conquer CS 320, Fall 2017 Dr. Geri Georg, Instructor georg@colostate.edu CS320 Div&Conq 1 Strategy 1. Divide the problem up into equal sized sub problems 2. Solve the sub problems recursively
More informationCSE548, AMS542: Analysis of Algorithms, Fall 2015 Date: October 12. In-Class Midterm. ( 1:05 PM 2:20 PM : 75 Minutes )
CSE548, AMS542: Analysis of Algorithms, Fall 2015 Date: October 12 In-Class Midterm ( 1:05 PM 2:20 PM : 75 Minutes ) This exam will account for either 15% or 30% of your overall grade depending on your
More informationCS 4407 Algorithms Lecture 3: Iterative and Divide and Conquer Algorithms
CS 4407 Algorithms Lecture 3: Iterative and Divide and Conquer Algorithms Prof. Gregory Provan Department of Computer Science University College Cork 1 Lecture Outline CS 4407, Algorithms Growth Functions
More informationDivide and Conquer. Recurrence Relations
Divide and Conquer Recurrence Relations Divide-and-Conquer Strategy: Break up problem into parts. Solve each part recursively. Combine solutions to sub-problems into overall solution. 2 MergeSort Mergesort.
More informationThe divide-and-conquer strategy solves a problem by: Chapter 2. Divide-and-conquer algorithms. Multiplication
The divide-and-conquer strategy solves a problem by: Chapter 2 Divide-and-conquer algorithms 1 Breaking it into subproblems that are themselves smaller instances of the same type of problem 2 Recursively
More informationLecture 1b: The Maximum Contiguous Subarray Problem
Lecture 1b: The Maximum Contiguous Subarray Problem Reference: Chapter 8 in Programming Pearls, (nd ed) by Jon Bentley. History: 1-D version of a a -D pattern recognition problem. Clean way to illustrate
More informationDivide and Conquer Strategy
Divide and Conquer Strategy Algorithm design is more an art, less so a science. There are a few useful strategies, but no guarantee to succeed. We will discuss: Divide and Conquer, Greedy, Dynamic Programming.
More informationAlgorithm Design and Analysis
Algorithm Design and Analysis LECTURE 14 Divide and Conquer Fast Fourier Transform Sofya Raskhodnikova 10/7/2016 S. Raskhodnikova; based on slides by K. Wayne. 5.6 Convolution and FFT Fast Fourier Transform:
More informationChapter 5. Divide and Conquer CLRS 4.3. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.
Chapter 5 Divide and Conquer CLRS 4.3 Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 1 Divide-and-Conquer Divide-and-conquer. Break up problem into several parts. Solve
More informationCSCI 3110 Assignment 6 Solutions
CSCI 3110 Assignment 6 Solutions December 5, 2012 2.4 (4 pts) Suppose you are choosing between the following three algorithms: 1. Algorithm A solves problems by dividing them into five subproblems of half
More informationProblem Set 2 Solutions
Introduction to Algorithms October 1, 2004 Massachusetts Institute of Technology 6.046J/18.410J Professors Piotr Indyk and Charles E. Leiserson Handout 9 Problem Set 2 Solutions Reading: Chapters 5-9,
More informationDiscrete Mathematics U. Waterloo ECE 103, Spring 2010 Ashwin Nayak May 17, 2010 Recursion
Discrete Mathematics U. Waterloo ECE 103, Spring 2010 Ashwin Nayak May 17, 2010 Recursion During the past week, we learnt about inductive reasoning, in which we broke down a problem of size n, into one
More informationDiscrete Mathematics. Kishore Kothapalli
Discrete Mathematics Kishore Kothapalli 2 Chapter 4 Advanced Counting Techniques In the previous chapter we studied various techniques for counting and enumeration. However, there are several interesting
More informationLecture 20: Discrete Fourier Transform and FFT
EE518 Digital Signal Processing University of Washington Autumn 2001 Dept of Electrical Engineering Lecture 20: Discrete Fourier Transform and FFT Dec 10, 2001 Prof: J Bilmes TA:
More informationCS 4104 Data and Algorithm Analysis. Recurrence Relations. Modeling Recursive Function Cost. Solving Recurrences. Clifford A. Shaffer.
Department of Computer Science Virginia Tech Blacksburg, Virginia Copyright c 2010,2017 by Clifford A. Shaffer Data and Algorithm Analysis Title page Data and Algorithm Analysis Clifford A. Shaffer Spring
More informationSolving recurrences. Frequently showing up when analysing divide&conquer algorithms or, more generally, recursive algorithms.
Solving recurrences Frequently showing up when analysing divide&conquer algorithms or, more generally, recursive algorithms Example: Merge-Sort(A, p, r) 1: if p < r then 2: q (p + r)/2 3: Merge-Sort(A,
More informationReview Of Topics. Review: Induction
Review Of Topics Asymptotic notation Solving recurrences Sorting algorithms Insertion sort Merge sort Heap sort Quick sort Counting sort Radix sort Medians/order statistics Randomized algorithm Worst-case
More informationOutline. Part 5. Computa0onal Complexity (3) Compound Interest 2/15/12. Recurrence Rela0ons: An Overview. Recurrence Rela0ons: Formal Defini0on
Outline Part 5. Computa0onal Complexity (3) Recurrence Relations Divide and Conquer Understanding the Complexity of Algorithms CS 200 Algorithms and Data Structures 1 2 Recurrence Rela0ons: An Overview
More information1 Caveats of Parallel Algorithms
CME 323: Distriuted Algorithms and Optimization, Spring 2015 http://stanford.edu/ reza/dao. Instructor: Reza Zadeh, Matroid and Stanford. Lecture 1, 9/26/2015. Scried y Suhas Suresha, Pin Pin, Andreas
More informationb + O(n d ) where a 1, b > 1, then O(n d log n) if a = b d d ) if a < b d O(n log b a ) if a > b d
CS161, Lecture 4 Median, Selection, and the Substitution Method Scribe: Albert Chen and Juliana Cook (2015), Sam Kim (2016), Gregory Valiant (2017) Date: January 23, 2017 1 Introduction Last lecture, we
More informationDesign and Analysis of Algorithms
Design and Analysis of Algorithms CSE 5311 Lecture 5 Divide and Conquer: Fast Fourier Transform Junzhou Huang, Ph.D. Department of Computer Science and Engineering CSE5311 Design and Analysis of Algorithms
More informationNotes for Recitation 14
6.04/18.06J Mathematics for Computer Science October 4, 006 Tom Leighton and Marten van Dijk Notes for Recitation 14 1 The Akra-Bazzi Theorem Theorem 1 (Akra-Bazzi, strong form). Suppose that: is defined
More informationCSI2101-W08- Recurrence Relations
Motivation CSI2101-W08- Recurrence Relations where do they come from modeling program analysis Solving Recurrence Relations by iteration arithmetic/geometric sequences linear homogenous recurrence relations
More informationComputational Complexity. This lecture. Notes. Lecture 02 - Basic Complexity Analysis. Tom Kelsey & Susmit Sarkar. Notes
Computational Complexity Lecture 02 - Basic Complexity Analysis Tom Kelsey & Susmit Sarkar School of Computer Science University of St Andrews http://www.cs.st-andrews.ac.uk/~tom/ twk@st-andrews.ac.uk
More informationData Structures and Algorithms CSE 465
Data Structures and Algorithms CSE 465 LECTURE 3 Asymptotic Notation O-, Ω-, Θ-, o-, ω-notation Divide and Conquer Merge Sort Binary Search Sofya Raskhodnikova and Adam Smith /5/0 Review Questions If input
More informationLecture 3. Big-O notation, more recurrences!!
Lecture 3 Big-O notation, more recurrences!! Announcements! HW1 is posted! (Due Friday) See Piazza for a list of HW clarifications First recitation section was this morning, there s another tomorrow (same
More informationGraduate Algorithms CS F-09 Dynamic Programming
Graduate Algorithms CS673-216F-9 Dynamic Programming David Galles Department of Computer Science University of San Francisco 9-: Recursive Solutions Divide a problem into smaller subproblems Recursively
More information1 Substitution method
Recurrence Relations we have discussed asymptotic analysis of algorithms and various properties associated with asymptotic notation. As many algorithms are recursive in nature, it is natural to analyze
More informationLecture 4. Quicksort
Lecture 4. Quicksort T. H. Cormen, C. E. Leiserson and R. L. Rivest Introduction to Algorithms, 3rd Edition, MIT Press, 2009 Sungkyunkwan University Hyunseung Choo choo@skku.edu Copyright 2000-2018 Networking
More informationMultiplying huge integers using Fourier transforms
Fourier transforms October 25, 2007 820348901038490238478324 1739423249728934932894??? integers occurs in many fields of Computational Science: Cryptography Number theory... Traditional approaches to
More informationAlgorithms Chapter 4 Recurrences
Algorithms Chapter 4 Recurrences Instructor: Ching Chi Lin 林清池助理教授 chingchi.lin@gmail.com Department of Computer Science and Engineering National Taiwan Ocean University Outline The substitution method
More information/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Asymptotic Analysis, recurrences Date: 9/7/17
601.433/633 Introduction to Algorithms Lecturer: Michael Dinitz Topic: Asymptotic Analysis, recurrences Date: 9/7/17 2.1 Notes Homework 1 will be released today, and is due a week from today by the beginning
More informationDivide and Conquer Algorithms
Divide and Conquer Algorithms Introduction There exist many problems that can be solved using a divide-and-conquer algorithm. A divide-andconquer algorithm A follows these general guidelines. Divide Algorithm
More information