Algorithms and data structures

Size: px
Start display at page:

Download "Algorithms and data structures"

Transcription

1 Algorithms and data structures Amin Coja-Oghlan LFCS

2 Complex numbers Roots of polynomials A polynomial of degree d is a function of the form p(x) = d a i x i with a d 0. i=0 There are at most d numbers ζ R such that p(ζ) = 0; they are called roots of p. Example: p(x) = x has no roots in R. Reminder: complex numbers Therefore, let s make up a new number i such that i 2 = 1. Then C = {x + i y : x,y R} is the field of complex numbers. A. Coja-Oghlan (LFCS) Algorithms and data structures 2 / 15

3 Complex numbers (ctd.) Reminder: complex numbers Therefore, let s make up a new number i such that i 2 = 1. Then C = {x + i y : x,y R} is the field of complex numbers. Manipulating complex numbers Addition: (x + iy) + (q + ir) = (x + q) + i(y + r). Multiplication: (x + iy) (q + ir) = (x q y r) + i(x r + y q). Conjugate: x + iy = x iy. Absolute value: x + iy = x 2 + y 2. A. Coja-Oghlan (LFCS) Algorithms and data structures 3 / 15

4 Complex numbers (ctd.) Theorem ( fundamental theorem of algebra ) Any polynomial p(x) = d i=0 a ix i with a i C and a d = 1 can be decomposed as p(x) = d (x ζ j ), where each ζ j C is a root of p. j=1 A. Coja-Oghlan (LFCS) Algorithms and data structures 4 / 15

5 Complex numbers (ctd.) Theorem ( fundamental theorem of algebra ) Any polynomial p(x) = d i=0 a ix i with a i C and a d = 1 can be decomposed as p(x) = The roots of unity d (x ζ j ), where each ζ j C is a root of p. j=1 For example, let p(x) = x d 1. Then d 1 p(x) = x ωd i, where i=0 ω d = cos(2π/d) + i sin(2π/d) = exp(2πi/d), where z j exp(z) = for all z C. j! j=0 A. Coja-Oghlan (LFCS) Algorithms and data structures 4 / 15

6 Complex numbers (ctd.) The roots of unity (ctd.) The complex number ω d = cos(2π/d) + i sin(2π/d) = exp(2πi/d) is called a d th principal root of unity. Its inverse is ω d = exp( 2πi/d) = ω d 1 d = ω d. ω d = 1. If d is even, then ω d/2 d = 1. A. Coja-Oghlan (LFCS) Algorithms and data structures 5 / 15

7 Complex numbers (ctd.) The roots of unity (ctd.) 2 w 8 = i w 8 = e i*2pi/8 = (cos (2 pi/8), i*sin(2 pi/8) = (1+i)/sqrt(2) 2pi/8 w 0 = 1 8 Wheel representation of 8th roots of unity in the complex plane. Same wheel structure for any n, with ω n sitting at angle 2π/n. A. Coja-Oghlan (LFCS) Algorithms and data structures 6 / 15

8 The Discrete Fourier Transform (DFT) Computational problem Input: a vector (a 0,...,a n 1 ) C n. Output: the vector (A(1),A(ω n ),A(ωn),... 2,A(ωn n 1 )), where n 1 A(x) = a j x j. Think of this vector as a fingerprint of the polynomial A(x)! j=0 A. Coja-Oghlan (LFCS) Algorithms and data structures 7 / 15

9 The Discrete Fourier Transform (DFT) Computational problem Input: a vector (a 0,...,a n 1 ) C n. Output: the vector (A(1),A(ω n ),A(ωn),... 2,A(ωn n 1 )), where n 1 A(x) = a j x j. Think of this vector as a fingerprint of the polynomial A(x)! Why bother? j=0 DFT is fundamental in signal processing, where it is usually implemented in hardware. Given a signal (e.g., a tune), DFT yields a decomposition by frequencies. This allows removing noise, amending the signal, etc. Further application: fast multiplication of polynomials (next lecture). A. Coja-Oghlan (LFCS) Algorithms and data structures 7 / 15

10 The Fast Fourier Transformation (FFT) Naive approach Compute A(1),A(ω n ),...,A(ωn n 1 ) separately Θ(n 2 ) multiplications. A. Coja-Oghlan (LFCS) Algorithms and data structures 8 / 15

11 The Fast Fourier Transformation (FFT) Naive approach Compute A(1),A(ω n ),...,A(ωn n 1 ) separately Θ(n 2 ) multiplications. A divide and conquer approach Consider a polynomial A(x) = n 1 j=0 a jx j, where n = 2 j for some j > 0. Define A even (y) = a 0 + a 2 y + a 4 y a n 2 y n 2 1, A odd (y) = a 1 + a 3 y + a 5 y a n 1 y n 2 1 ; A(x) = A even (x 2 ) + x A odd (x 2 ). so that Observation: reduction from degree n problem to two degree n 2 problems. Suggests T(n) = 2T(n/2) + O(n) T(n) = Θ(n lnn). A. Coja-Oghlan (LFCS) Algorithms and data structures 8 / 15

12 The FFT (ctd.) How do we deal with A even (x 2 ), A odd (x 2 )? Goal: compute A even (ω 2k n ), A odd (ω 2k n ) for 0 k < n. Key observation: ω 2 n = exp(2πi/n)2 = exp(2πi/(n/2)) = ω n/2. A. Coja-Oghlan (LFCS) Algorithms and data structures 9 / 15

13 The FFT (ctd.) How do we deal with A even (x 2 ), A odd (x 2 )? Goal: compute A even (ω 2k n ), A odd (ω 2k n ) for 0 k < n. Key observation: ω 2 n = exp(2πi/n)2 = exp(2πi/(n/2)) = ω n/2. Therefore, ω 2k n = ω k n/2 for all k. Hence, A(1) = A even (1) + 1 A odd (1), A(ω n ) = A even (ω n/2 ) + ω n A odd (ω n/2 ), A(ω 2 n) = A even (ω 2 n/2 ) + ω n A odd (ω 2 n/2 ),. A(ω n 2 1 n ) = A even (ω n 2 1 n/2 ) + ω n A odd (ω n 2 1 n/2 ). A. Coja-Oghlan (LFCS) Algorithms and data structures 9 / 15

14 The FFT (ctd.) How do we deal with A even (x 2 ), A odd (x 2 )? Goal: compute A even (ω 2k n ), A odd (ω 2k n ) for 0 k < n. Key observation: ω 2 n = exp(2πi/n)2 = exp(2πi/(n/2)) = ω n/2. Therefore, A(ωn) k = A even (ωn/2 k ) + ω n A odd (ωn/2 k ) for all k. Furthermore, as ω n/2 n = 1 and ω n n = 1, we can simplify for n 2 k < n: A(ω n 2 n ) = A even (1) 1 A odd (1), A(ω n 2 +1 n ) = A even (ω n/2 ) ω n A odd (ω n/2 ),. A(ωn n 1 ) = A even (ω n 2 1 n/2 ) ω n 2 1 n A odd (ω n 2 1 n/2 ). A. Coja-Oghlan (LFCS) Algorithms and data structures 10 / 15

15 The FFT (ctd.) How do we deal with A even (x 2 ), A odd (x 2 )? Goal: compute A even (ωn 2k), A odd(ωn 2k ) for 0 k < n. Summary: use the relations for 0 k < n 2. A(ω k n) = A even (ω k n/2 ) + ω n A odd (ω k n/2 ), A(ω n 2 +k n ) = A even (ω k n/2 ) ω n A odd (ω k n/2 ) A. Coja-Oghlan (LFCS) Algorithms and data structures 11 / 15

16 The FFT (ctd.) How do we deal with A even (x 2 ), A odd (x 2 )? Goal: compute A even (ωn 2k), A odd(ωn 2k ) for 0 k < n. Summary: use the relations for 0 k < n 2. Thus, all we need to know is A(ω k n) = A even (ω k n/2 ) + ω n A odd (ω k n/2 ), A(ω n 2 +k n ) = A even (ω k n/2 ) ω n A odd (ω k n/2 ) i.e., the DFTs of A even and A odd. A even (ω k n/2 ) for 0 k < n 2, A odd (ω k n/2 ) for 0 k < n 2, A. Coja-Oghlan (LFCS) Algorithms and data structures 11 / 15

17 The FFT (ctd.) Sketch of the algorithm Goal: compute the DFT of A(x), i.e., (A(ω k n)) 0 k<n, where n = 2 j. If n = 1, the result is just A(1) = n 1 i=0 a i. A. Coja-Oghlan (LFCS) Algorithms and data structures 12 / 15

18 The FFT (ctd.) Sketch of the algorithm Goal: compute the DFT of A(x), i.e., (A(ω k n)) 0 k<n, where n = 2 j. If n = 1, the result is just A(1) = n 1 i=0 a i. Suppose n > 1. Set up A even and A odd. Recurse to compute the DFTs of A even and A odd, i.e., (A even (ω k n/2 )) 0 k< n 2, (A odd(ω k n/2 )) 0 k< n 2. A. Coja-Oghlan (LFCS) Algorithms and data structures 12 / 15

19 The FFT (ctd.) Sketch of the algorithm Goal: compute the DFT of A(x), i.e., (A(ω k n)) 0 k<n, where n = 2 j. If n = 1, the result is just A(1) = n 1 i=0 a i. Suppose n > 1. Set up A even and A odd. Recurse to compute the DFTs of A even and A odd, i.e., (A even (ω k n/2 )) 0 k< n 2, (A odd(ω k n/2 )) 0 k< n 2. Since for 0 k < n 2 A(ω k n ) = A even(ω k n/2 ) + ω n A odd (ω k n/2 ), A(ω n 2 +k n ) = A even (ω k n/2 ) ω n A odd (ω k n/2 ) we can complete the task in O(n) operations. A. Coja-Oghlan (LFCS) Algorithms and data structures 12 / 15

20 The FFT (ctd.) Algorithm FFT(a 0,...,a n 1 ) Input: a vector (a 0,...,a n 1 ) C n. Output: (A(1),...,A(ω n 1 n )) C n. 1 If n = 1, return a 0. Otherwise do the following. 2 Let ω n = exp(2πi/n) and ω = 1. 3 Let (y 0,...,y n/2 1 ) = FFT(a 0,a 2,a 4,...,a n 2 ) // even part 4 Let (z 0,...,z n/2 1 ) = FFT(a 1,a 3,a 5,...,a n 1 ) // odd part A. Coja-Oghlan (LFCS) Algorithms and data structures 13 / 15

21 The FFT (ctd.) Algorithm FFT(a 0,...,a n 1 ) Input: a vector (a 0,...,a n 1 ) C n. Output: (A(1),...,A(ω n 1 n )) C n. 1 If n = 1, return a 0. Otherwise do the following. 2 Let ω n = exp(2πi/n) and ω = 1. 3 Let (y 0,...,y n/2 1 ) = FFT(a 0,a 2,a 4,...,a n 2 ) // even part 4 Let (z 0,...,z n/2 1 ) = FFT(a 1,a 3,a 5,...,a n 1 ) // odd part 5 For k = 0,..., n 2 1 do 6 let â k = y k + ωz k and â k+ n 2 = y k ωz k. 7 let ω = ω ω n. 8 Return (â 0,...,â n 1 ). We may assume that n = 2 j (if not we just pad the input with zeros). A. Coja-Oghlan (LFCS) Algorithms and data structures 13 / 15

22 The FFT (ctd.) Running time of FFT The running time satisfies the recurrence T(n) = 2T(n/2) + Θ(n). Master theorem T(n) = Θ(n lnn). By comparison, the naive algorithm takes time T(n) = Θ(n 2 ). Thus, we (almost) save a factor of n. Numerical issue: computing with complex numbers this can be avoided. In fact, FFT is easy to implement in hardware. A. Coja-Oghlan (LFCS) Algorithms and data structures 14 / 15

23 Reading assignment Check out... Fast Fourier Transform by Mary Cryan (see course website). [CLRS] Section A. Coja-Oghlan (LFCS) Algorithms and data structures 15 / 15

Chapter 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 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 information

Divide and Conquer algorithms

Divide 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 information

FFT: Fast Polynomial Multiplications

FFT: 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 information

CSE 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. 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 information

Fast Convolution; Strassen s Method

Fast 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 information

The Fast Fourier Transform: A Brief Overview. with Applications. Petros Kondylis. Petros Kondylis. December 4, 2014

The Fast Fourier Transform: A Brief Overview. with Applications. Petros Kondylis. Petros Kondylis. December 4, 2014 December 4, 2014 Timeline Researcher Date Length of Sequence Application CF Gauss 1805 Any Composite Integer Interpolation of orbits of celestial bodies F Carlini 1828 12 Harmonic Analysis of Barometric

More information

The Fast Fourier Transform. Andreas Klappenecker

The 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 information

Mid-term Exam Answers and Final Exam Study Guide CIS 675 Summer 2010

Mid-term Exam Answers and Final Exam Study Guide CIS 675 Summer 2010 Mid-term Exam Answers and Final Exam Study Guide CIS 675 Summer 2010 Midterm Problem 1: Recall that for two functions g : N N + and h : N N +, h = Θ(g) iff for some positive integer N and positive real

More information

Multiplying huge integers using Fourier transforms

Multiplying 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 information

5.6 Convolution and FFT

5.6 Convolution and FFT 5.6 Convolution and FFT Fast Fourier Transform: Applications Applications. Optics, acoustics, quantum physics, telecommunications, control systems, signal processing, speech recognition, data compression,

More information

Fast Fourier Transform

Fast Fourier Transform Why Fourier Transform? Fast Fourier Transform Jordi Cortadella and Jordi Petit Department of Computer Science Polynomials: coefficient representation Divide & Conquer Dept. CS, UPC Polynomials: point-value

More information

Design and Analysis of Algorithms

Design 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 information

CSE 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 ) 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 information

Chapter 1 Divide and Conquer Algorithm Theory WS 2016/17 Fabian Kuhn

Chapter 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 information

DIVIDE AND CONQUER II

DIVIDE 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 information

Integer multiplication with generalized Fermat primes

Integer multiplication with generalized Fermat primes Integer multiplication with generalized Fermat primes CARAMEL Team, LORIA, University of Lorraine Supervised by: Emmanuel Thomé and Jérémie Detrey Journées nationales du Calcul Formel 2015 (Cluny) November

More information

CS483 Design and Analysis of Algorithms

CS483 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 information

Honors Advanced Algebra Unit 3: Polynomial Functions November 9, 2016 Task 11: Characteristics of Polynomial Functions

Honors Advanced Algebra Unit 3: Polynomial Functions November 9, 2016 Task 11: Characteristics of Polynomial Functions Honors Advanced Algebra Name Unit 3: Polynomial Functions November 9, 2016 Task 11: Characteristics of Polynomial Functions MGSE9 12.F.IF.7 Graph functions expressed symbolically and show key features

More information

Algorithm Design and Analysis

Algorithm 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 information

Georgia Department of Education Common Core Georgia Performance Standards Framework CCGPS Advanced Algebra Unit 2

Georgia Department of Education Common Core Georgia Performance Standards Framework CCGPS Advanced Algebra Unit 2 Polynomials Patterns Task 1. To get an idea of what polynomial functions look like, we can graph the first through fifth degree polynomials with leading coefficients of 1. For each polynomial function,

More information

Lecture 20: Discrete Fourier Transform and FFT

Lecture 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 information

CS S Lecture 5 January 29, 2019

CS S Lecture 5 January 29, 2019 CS 6363.005.19S Lecture 5 January 29, 2019 Main topics are #divide-and-conquer with #fast_fourier_transforms. Prelude Homework 1 is due Tuesday, February 5th. I hope you ve at least looked at it by now!

More information

Fast Polynomial Multiplication

Fast Polynomial Multiplication Fast Polynomial Multiplication Marc Moreno Maza CS 9652, October 4, 2017 Plan Primitive roots of unity The discrete Fourier transform Convolution of polynomials The fast Fourier transform Fast convolution

More information

Divide and Conquer: Polynomial Multiplication Version of October 1 / 7, 24201

Divide and Conquer: Polynomial Multiplication Version of October 1 / 7, 24201 Divide and Conquer: Polynomial Multiplication Version of October 7, 2014 Divide and Conquer: Polynomial Multiplication Version of October 1 / 7, 24201 Outline Outline: Introduction The polynomial multiplication

More information

CS/COE 1501 cs.pitt.edu/~bill/1501/ Integer Multiplication

CS/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 information

Divide and conquer. Philip II of Macedon

Divide 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 information

! Circular Convolution. " Linear convolution with circular convolution. ! Discrete Fourier Transform. " Linear convolution through circular

! Circular Convolution.  Linear convolution with circular convolution. ! Discrete Fourier Transform.  Linear convolution through circular Previously ESE 531: Digital Signal Processing Lec 22: April 18, 2017 Fast Fourier Transform (con t)! Circular Convolution " Linear convolution with circular convolution! Discrete Fourier Transform " Linear

More information

Introduction to Algorithms 6.046J/18.401J/SMA5503

Introduction 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 information

Legendre s Equation. PHYS Southern Illinois University. October 18, 2016

Legendre s Equation. PHYS Southern Illinois University. October 18, 2016 Legendre s Equation PHYS 500 - Southern Illinois University October 18, 2016 PHYS 500 - Southern Illinois University Legendre s Equation October 18, 2016 1 / 11 Legendre s Equation Recall We are trying

More information

Design and Analysis of Algorithms Recurrence. Prof. Chuhua Xian School of Computer Science and Engineering

Design and Analysis of Algorithms Recurrence. Prof. Chuhua Xian   School of Computer Science and Engineering Design and Analysis of Algorithms Recurrence Prof. Chuhua Xian Email: chhxian@scut.edu.cn School of Computer Science and Engineering Course Information Instructor: Chuhua Xian ( 冼楚华 ) Email: chhxian@scut.edu.cn

More information

Parallel Numerical Algorithms

Parallel Numerical Algorithms Parallel Numerical Algorithms Chapter 13 Prof. Michael T. Heath Department of Computer Science University of Illinois at Urbana-Champaign CS 554 / CSE 512 Michael T. Heath Parallel Numerical Algorithms

More information

Chapter 23. Fast Fourier Transform Introduction. By Sariel Har-Peled, November 28, Version: 0.11

Chapter 23. Fast Fourier Transform Introduction. By Sariel Har-Peled, November 28, Version: 0.11 Chapter 23 Fast Fourier Transform By Sariel Har-Peled, November 28, 208 Version: 0 But now, reflecting further, there begins to creep into his breast a touch of fellow-feeling for his imitators For it

More information

Chapter 5 Divide and Conquer

Chapter 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 information

Interpolation on the unit circle

Interpolation on the unit circle Lecture 2: The Fast Discrete Fourier Transform Interpolation on the unit circle So far, we have considered interpolation of functions at nodes on the real line. When we model periodic phenomena, it is

More information

Data Structures and Algorithms CMPSC 465

Data Structures and Algorithms CMPSC 465 Data Structures and Algorithms CMPSC 465 LECTURE 9 Solving recurrences Substitution method Adam Smith S. Raskhodnikova and A. Smith; based on slides by E. Demaine and C. Leiserson Review question Draw

More information

Practical Session #3 - Recursions

Practical Session #3 - Recursions Practical Session #3 - Recursions Substitution method Guess the form of the solution and prove it by induction Iteration Method Convert the recurrence into a summation and solve it Tightly bound a recurrence

More information

Divide and Conquer. Maximum/minimum. Median finding. CS125 Lecture 4 Fall 2016

Divide 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 information

Scientific Computing: An Introductory Survey

Scientific Computing: An Introductory Survey Scientific Computing: An Introductory Survey Chapter 12 Prof. Michael T. Heath Department of Computer Science University of Illinois at Urbana-Champaign Copyright c 2002. Reproduction permitted for noncommercial,

More information

Divide and Conquer. Andreas Klappenecker

Divide 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 information

The O () notation. Definition: Let f(n), g(n) be functions of the natural (or real)

The O () notation. Definition: Let f(n), g(n) be functions of the natural (or real) The O () notation When analyzing the runtime of an algorithm, we want to consider the time required for large n. We also want to ignore constant factors (which often stem from tricks and do not indicate

More information

4.3 The Discrete Fourier Transform (DFT) and the Fast Fourier Transform (FFT)

4.3 The Discrete Fourier Transform (DFT) and the Fast Fourier Transform (FFT) CHAPTER. TIME-FREQUECY AALYSIS: FOURIER TRASFORMS AD WAVELETS.3 The Discrete Fourier Transform (DFT and the Fast Fourier Transform (FFT.3.1 Introduction In this section, we discuss some of the mathematics

More information

arxiv:math/ v1 [math.na] 12 Jul 2004

arxiv:math/ v1 [math.na] 12 Jul 2004 arxiv:math/0407177v1 [math.na] 12 Jul 2004 On improving the accuracy of Horner s and Goertzel s algorithms Alica Smoktunowicz and Iwona Wróbel Faculty of Mathematics and Information Science, Warsaw University

More information

6.003 Signal Processing

6.003 Signal Processing 6.003 Signal Processing Week 6, Lecture A: The Discrete Fourier Transform (DFT) Adam Hartz hz@mit.edu What is 6.003? What is a signal? Abstractly, a signal is a function that conveys information Signal

More information

CSCI Honor seminar in algorithms Homework 2 Solution

CSCI Honor seminar in algorithms Homework 2 Solution CSCI 493.55 Honor seminar in algorithms Homework 2 Solution Saad Mneimneh Visiting Professor Hunter College of CUNY Problem 1: Rabin-Karp string matching Consider a binary string s of length n and another

More information

Fall 2011, EE123 Digital Signal Processing

Fall 2011, EE123 Digital Signal Processing Lecture 6 Miki Lustig, UCB September 11, 2012 Miki Lustig, UCB DFT and Sampling the DTFT X (e jω ) = e j4ω sin2 (5ω/2) sin 2 (ω/2) 5 x[n] 25 X(e jω ) 4 20 3 15 2 1 0 10 5 1 0 5 10 15 n 0 0 2 4 6 ω 5 reconstructed

More information

Computational Methods CMSC/AMSC/MAPL 460

Computational Methods CMSC/AMSC/MAPL 460 Computational Methods CMSC/AMSC/MAPL 460 Fourier transform Balaji Vasan Srinivasan Dept of Computer Science Several slides from Prof Healy s course at UMD Last time: Fourier analysis F(t) = A 0 /2 + A

More information

6.003 Signal Processing

6.003 Signal Processing 6.003 Signal Processing Week 6, Lecture A: The Discrete Fourier Transform (DFT) Adam Hartz hz@mit.edu What is 6.003? What is a signal? Abstractly, a signal is a function that conveys information Signal

More information

CSE 421. Dynamic Programming Shortest Paths with Negative Weights Yin Tat Lee

CSE 421. Dynamic Programming Shortest Paths with Negative Weights Yin Tat Lee CSE 421 Dynamic Programming Shortest Paths with Negative Weights Yin Tat Lee 1 Shortest Paths with Neg Edge Weights Given a weighted directed graph G = V, E and a source vertex s, where the weight of edge

More information

Algebra III Chapter 2 Note Packet. Section 2.1: Polynomial Functions

Algebra III Chapter 2 Note Packet. Section 2.1: Polynomial Functions Algebra III Chapter 2 Note Packet Name Essential Question: Section 2.1: Polynomial Functions Polynomials -Have nonnegative exponents -Variables ONLY in -General Form n ax + a x +... + ax + ax+ a n n 1

More information

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

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 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 information

Phase transitions in discrete structures

Phase transitions in discrete structures Phase transitions in discrete structures Amin Coja-Oghlan Goethe University Frankfurt Overview 1 The physics approach. [following Mézard, Montanari 09] Basics. Replica symmetry ( Belief Propagation ).

More information

Solving Differential Equations Using Power Series

Solving Differential Equations Using Power Series LECTURE 25 Solving Differential Equations Using Power Series We are now going to employ power series to find solutions to differential equations of the form (25.) y + p(x)y + q(x)y = 0 where the functions

More information

Solving Differential Equations Using Power Series

Solving Differential Equations Using Power Series LECTURE 8 Solving Differential Equations Using Power Series We are now going to employ power series to find solutions to differential equations of the form () y + p(x)y + q(x)y = 0 where the functions

More information

Sequential Fast Fourier Transform (PSC ) Sequential FFT

Sequential Fast Fourier Transform (PSC ) Sequential FFT Sequential Fast Fourier Transform (PSC 3.1 3.2) 1 / 18 Applications of Fourier analysis Fourier analysis studies the decomposition of functions into their frequency components. Piano Concerto no. 9 by

More information

Fourier Series. (Com S 477/577 Notes) Yan-Bin Jia. Nov 29, 2016

Fourier Series. (Com S 477/577 Notes) Yan-Bin Jia. Nov 29, 2016 Fourier Series (Com S 477/577 otes) Yan-Bin Jia ov 9, 016 1 Introduction Many functions in nature are periodic, that is, f(x+τ) = f(x), for some fixed τ, which is called the period of f. Though function

More information

2.161 Signal Processing: Continuous and Discrete Fall 2008

2.161 Signal Processing: Continuous and Discrete Fall 2008 MIT OpenCourseWare http://ocw.mit.edu 2.161 Signal rocessing: Continuous and Discrete Fall 2008 For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. Massachusetts

More information

An Illustrated Introduction to the Truncated Fourier Transform

An Illustrated Introduction to the Truncated Fourier Transform An Illustrated Introduction to the Truncated Fourier Transform arxiv:1602.04562v2 [cs.sc] 17 Feb 2016 Paul Vrbik. School of Mathematical and Physical Sciences The University of Newcastle Callaghan, Australia

More information

Data Structures and Algorithms CSE 465

Data 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 information

Lecture 5. The Digital Fourier Transform. (Based, in part, on The Scientist and Engineer's Guide to Digital Signal Processing by Steven Smith)

Lecture 5. The Digital Fourier Transform. (Based, in part, on The Scientist and Engineer's Guide to Digital Signal Processing by Steven Smith) Lecture 5 The Digital Fourier Transform (Based, in part, on The Scientist and Engineer's Guide to Digital Signal Processing by Steven Smith) 1 -. 8 -. 6 -. 4 -. 2-1 -. 8 -. 6 -. 4 -. 2 -. 2. 4. 6. 8 1

More information

Midterm 1 for CS 170

Midterm 1 for CS 170 UC Berkeley CS 170 Midterm 1 Lecturer: Satish Rao October 2 Midterm 1 for CS 170 Print your name:, (last) (first) Sign your name: Write your section number (e.g., 101): Write your SID: One page of notes

More information

Recursion. Algorithms and Data Structures. (c) Marcin Sydow. Introduction. Linear 2nd-order Equations. Important 3 Cases. Quicksort Average Complexity

Recursion. Algorithms and Data Structures. (c) Marcin Sydow. Introduction. Linear 2nd-order Equations. Important 3 Cases. Quicksort Average Complexity Recursion Topics covered by this lecture: Recursion: Fibonacci numbers, Hanoi Towers,... cases of recursive equations (with proofs) QuickSort (Proof) Recursion e.g.: n! = (n 1)!n Mathematics: recurrent

More information

CSE 421 Algorithms: Divide and Conquer

CSE 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 information

MA3232 Summary 5. d y1 dy1. MATLAB has a number of built-in functions for solving stiff systems of ODEs. There are ode15s, ode23s, ode23t, ode23tb.

MA3232 Summary 5. d y1 dy1. MATLAB has a number of built-in functions for solving stiff systems of ODEs. There are ode15s, ode23s, ode23t, ode23tb. umerical solutions of higher order ODE We can convert a high order ODE into a system of first order ODEs and then apply RK method to solve it. Stiff ODEs Stiffness is a special problem that can arise in

More information

Polynomials Patterns Task

Polynomials Patterns Task Polynomials Patterns Task Mathematical Goals Roughly sketch the graphs of simple polynomial functions by hand Graph polynomial functions using technology Identify key features of the graphs of polynomial

More information

Kartsuba s Algorithm and Linear Time Selection

Kartsuba 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 information

MS 3011 Exercises. December 11, 2013

MS 3011 Exercises. December 11, 2013 MS 3011 Exercises December 11, 2013 The exercises are divided into (A) easy (B) medium and (C) hard. If you are particularly interested I also have some projects at the end which will deepen your understanding

More information

1 Substitution method

1 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 information

Algorithms and Data Structures Strassen s Algorithm. ADS (2017/18) Lecture 4 slide 1

Algorithms and Data Structures Strassen s Algorithm. ADS (2017/18) Lecture 4 slide 1 Algorithms and Data Structures Strassen s Algorithm ADS (2017/18) Lecture 4 slide 1 Tutorials Start in week (week 3) Tutorial allocations are linked from the course webpage http://www.inf.ed.ac.uk/teaching/courses/ads/

More information

CMPSCI 240: Reasoning Under Uncertainty

CMPSCI 240: Reasoning Under Uncertainty CMPSCI 240: Reasoning Under Uncertainty Lecture 8 Prof. Hanna Wallach wallach@cs.umass.edu February 16, 2012 Reminders Check the course website: http://www.cs.umass.edu/ ~wallach/courses/s12/cmpsci240/

More information

Course Notes for EE227C (Spring 2018): Convex Optimization and Approximation

Course Notes for EE227C (Spring 2018): Convex Optimization and Approximation Course Notes for EE7C (Spring 018): Convex Optimization and Approximation Instructor: Moritz Hardt Email: hardt+ee7c@berkeley.edu Graduate Instructor: Max Simchowitz Email: msimchow+ee7c@berkeley.edu October

More information

The 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. 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 information

CS 829 Polynomial systems: geometry and algorithms Lecture 3: Euclid, resultant and 2 2 systems Éric Schost

CS 829 Polynomial systems: geometry and algorithms Lecture 3: Euclid, resultant and 2 2 systems Éric Schost CS 829 Polynomial systems: geometry and algorithms Lecture 3: Euclid, resultant and 2 2 systems Éric Schost eschost@uwo.ca Summary In this lecture, we start actual computations (as opposed to Lectures

More information

AH Complex Numbers.notebook October 12, 2016

AH Complex Numbers.notebook October 12, 2016 Complex Numbers Complex Numbers Complex Numbers were first introduced in the 16th century by an Italian mathematician called Cardano. He referred to them as ficticious numbers. Given an equation that does

More information

Asymptotic Analysis and Recurrences

Asymptotic 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 information

Inf 2B: Sorting, MergeSort and Divide-and-Conquer

Inf 2B: Sorting, MergeSort and Divide-and-Conquer Inf 2B: Sorting, MergeSort and Divide-and-Conquer Lecture 7 of ADS thread Kyriakos Kalorkoti School of Informatics University of Edinburgh The Sorting Problem Input: Task: Array A of items with comparable

More information

The Divide-and-Conquer Design Paradigm

The 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 information

Unit 4 Polynomial/Rational Functions Zeros of Polynomial Functions (Unit 4.3)

Unit 4 Polynomial/Rational Functions Zeros of Polynomial Functions (Unit 4.3) Unit 4 Polynomial/Rational Functions Zeros of Polynomial Functions (Unit 4.3) William (Bill) Finch Mathematics Department Denton High School Lesson Goals When you have completed this lesson you will: Find

More information

Old and new algorithms for computing Bernoulli numbers

Old and new algorithms for computing Bernoulli numbers Old and new algorithms for computing Bernoulli numbers University of New South Wales 25th September 2012, University of Ballarat Bernoulli numbers Rational numbers B 0, B 1,... defined by: x e x 1 = n

More information

Sequential Fast Fourier Transform

Sequential Fast Fourier Transform Sequential Fast Fourier Transform Departement Computerwetenschappen Room 03.018 (Celestijnenlaan 200A) albert-jan.yzelman@cs.kuleuven.be Includes material from slides by Prof. dr. Rob H. Bisseling Applications

More information

Jim Lambers ENERGY 281 Spring Quarter Lecture 5 Notes

Jim Lambers ENERGY 281 Spring Quarter Lecture 5 Notes Jim ambers ENERGY 28 Spring Quarter 27-8 ecture 5 Notes These notes are based on Rosalind Archer s PE28 lecture notes, with some revisions by Jim ambers. Fourier Series Recall that in ecture 2, when we

More information

Tutorials. Algorithms and Data Structures Strassen s Algorithm. The Master Theorem for solving recurrences. The Master Theorem (cont d)

Tutorials. Algorithms and Data Structures Strassen s Algorithm. The Master Theorem for solving recurrences. The Master Theorem (cont d) DS 2018/19 Lecture 4 slide 3 DS 2018/19 Lecture 4 slide 4 Tutorials lgorithms and Data Structures Strassen s lgorithm Start in week week 3 Tutorial allocations are linked from the course webpage http://www.inf.ed.ac.uk/teaching/courses/ads/

More information

1 Caveats of Parallel Algorithms

1 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 information

x + x y = 1... (1) and y = 7... (2) x + x 2 49 = 1 x = 1 + x 2 2x 2x = 48 x = 24 z 2 = x 2 + y 2 = 625 Ans.]

x + x y = 1... (1) and y = 7... (2) x + x 2 49 = 1 x = 1 + x 2 2x 2x = 48 x = 24 z 2 = x 2 + y 2 = 625 Ans.] Q. If + 0 then which of the following must be true on the complex plane? (A) Re() < 0 (B*) Re() 0 (C) Im() 0 (D) [Hint: ( + ) 0 0 or i 0 or ± i Re() 0] Q. There is only one way to choose real numbers M

More information

Discrete Fourier Transform

Discrete Fourier Transform Discrete Fourier Transform Valentina Hubeika, Jan Černocký DCGM FIT BUT Brno, {ihubeika,cernocky}@fit.vutbr.cz Diskrete Fourier transform (DFT) We have just one problem with DFS that needs to be solved.

More information

Design Patterns for Data Structures. Chapter 3. Recursive Algorithms

Design Patterns for Data Structures. Chapter 3. Recursive Algorithms Chapter 3 Recursive Algorithms Writing recurrences + Writing recurrences To determine the statement execution count is a two-step problem. Write down the recurrence from the recursive code for the algorithm.

More information

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. Prof. R. Fateman

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. Prof. R. Fateman UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division CS 282 Spring, 2000 Prof. R. Fateman The (finite field) Fast Fourier Transform 0. Introduction

More information

Computational Methods CMSC/AMSC/MAPL 460. Fourier transform

Computational Methods CMSC/AMSC/MAPL 460. Fourier transform Computational Methods CMSC/AMSC/MAPL 460 Fourier transform Ramani Duraiswami, Dept. of Computer Science Several slides from Prof. Healy s course at UMD Fourier Methods Fourier analysis ( harmonic analysis

More information

Divide and Conquer. Andreas Klappenecker. [based on slides by Prof. Welch]

Divide 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 information

How to Multiply. 5.5 Integer Multiplication. Complex Multiplication. Integer Arithmetic. Complex multiplication. (a + bi) (c + di) = x + yi.

How to Multiply. 5.5 Integer Multiplication. Complex Multiplication. Integer Arithmetic. Complex multiplication. (a + bi) (c + di) = x + yi. How to ultiply Slides by Kevin Wayne. Copyright 5 Pearson-Addison Wesley. All rights reserved. integers, matrices, and polynomials Complex ultiplication Complex multiplication. a + bi) c + di) = x + yi.

More information

A 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/ 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 information

Computational Complexity. This lecture. Notes. Lecture 02 - Basic Complexity Analysis. Tom Kelsey & Susmit Sarkar. Notes

Computational 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 information

Algorithms Chapter 4 Recurrences

Algorithms 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

COE428 Notes Week 4 (Week of Jan 30, 2017)

COE428 Notes Week 4 (Week of Jan 30, 2017) COE428 Lecture Notes: Week 4 1 of 9 COE428 Notes Week 4 (Week of Jan 30, 2017) Table of Contents Announcements...2 Answers to last week's questions...2 Review...3 Big-O, Big-Omega and Big-Theta analysis

More information

The Kernel Trick, Gram Matrices, and Feature Extraction. CS6787 Lecture 4 Fall 2017

The Kernel Trick, Gram Matrices, and Feature Extraction. CS6787 Lecture 4 Fall 2017 The Kernel Trick, Gram Matrices, and Feature Extraction CS6787 Lecture 4 Fall 2017 Momentum for Principle Component Analysis CS6787 Lecture 3.1 Fall 2017 Principle Component Analysis Setting: find the

More information

Asymptotic Algorithm Analysis & Sorting

Asymptotic Algorithm Analysis & Sorting Asymptotic Algorithm Analysis & Sorting (Version of 5th March 2010) (Based on original slides by John Hamer and Yves Deville) We can analyse an algorithm without needing to run it, and in so doing we can

More information

Quantum algorithms (CO 781/CS 867/QIC 823, Winter 2013) Andrew Childs, University of Waterloo LECTURE 13: Query complexity and the polynomial method

Quantum algorithms (CO 781/CS 867/QIC 823, Winter 2013) Andrew Childs, University of Waterloo LECTURE 13: Query complexity and the polynomial method Quantum algorithms (CO 781/CS 867/QIC 823, Winter 2013) Andrew Childs, University of Waterloo LECTURE 13: Query complexity and the polynomial method So far, we have discussed several different kinds of

More information

ELEG 305: Digital Signal Processing

ELEG 305: Digital Signal Processing ELEG 5: Digital Signal Processing Lecture 6: The Fast Fourier Transform; Radix Decimatation in Time Kenneth E. Barner Department of Electrical and Computer Engineering University of Delaware Fall 8 K.

More information

The Master Theorem for solving recurrences. Algorithms and Data Structures Strassen s Algorithm. Tutorials. The Master Theorem (cont d)

The Master Theorem for solving recurrences. Algorithms and Data Structures Strassen s Algorithm. Tutorials. The Master Theorem (cont d) The Master Theorem for solving recurrences lgorithms and Data Structures Strassen s lgorithm 23rd September, 2014 Theorem Let n 0 N, k N 0 and a, b R with a > 0 and b > 1, and let T : N R satisfy the following

More information

A NOVEL METHOD TO DERIVE EXPLICIT KLT KERNEL FOR AR(1) PROCESS. Mustafa U. Torun and Ali N. Akansu

A NOVEL METHOD TO DERIVE EXPLICIT KLT KERNEL FOR AR(1) PROCESS. Mustafa U. Torun and Ali N. Akansu A NOVEL METHOD TO DERIVE EXPLICIT KLT KERNEL FOR AR() PROCESS Mustafa U. Torun and Ali N. Akansu Department of Electrical and Computer Engineering New Jersey Institute of Technology University Heights,

More information

Implementing Fast Carryless Multiplication

Implementing Fast Carryless Multiplication Implementing Fast Carryless Multiplication Joris van der Hoeven, Robin Larrieu and Grégoire Lecerf CNRS & École polytechnique MACIS 2017 Nov. 15, Vienna, Austria van der Hoeven, Larrieu, Lecerf Implementing

More information