Instructor: Shengyu Zhang 1. Example 1: Merge sort 2.

Slides:



Advertisements
Similar presentations
Fast Fourier Transform for speeding up the multiplication of polynomials an Algorithm Visualization Alexandru Cioaca.
Advertisements

Back to Sorting – More efficient sorting algorithms.
Counting the bits Analysis of Algorithms Will it run on a larger problem? When will it fail?
Algorithms Analysis Lecture 6 Quicksort. Quick Sort Divide and Conquer.
A simple example finding the maximum of a set S of n numbers.
Instructor Neelima Gupta Table of Contents Divide and Conquer.
Divide and Conquer Strategy
Dr. Deshi Ye Divide-and-conquer Dr. Deshi Ye
1 Divide & Conquer Algorithms. 2 Recursion Review A function that calls itself either directly or indirectly through another function Recursive solutions.
Divide-and-Conquer Recursive in structure –Divide the problem into several smaller sub-problems that are similar to the original but smaller in size –Conquer.
CS223 Advanced Data Structures and Algorithms 1 Divide and Conquer Neil Tang 4/15/2010.
Fast Fourier Transform Lecture 6 Spoken Language Processing Prof. Andrew Rosenberg.
CIT 596 Complexity. Tight bounds Is mergesort O(n 4 )? YES! But it is silly to use that as your measure More common to hear it as….? What about quicksort?
Lecture 8 Jianjun Hu Department of Computer Science and Engineering University of South Carolina CSCE350 Algorithms and Data Structure.
Princeton University COS 423 Theory of Algorithms Spring 2002 Kevin Wayne Fast Fourier Transform Jean Baptiste Joseph Fourier ( ) These lecture.
Recurrences The expression: is a recurrence. –Recurrence: an equation that describes a function in terms of its value on smaller functions Analysis of.
Introduction to Algorithms
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 14 Instructor: Paul Beame.
1 CSE 417: Algorithms and Computational Complexity Winter 2001 Lecture 5 Instructor: Paul Beame TA: Gidon Shavit.
Unit 1. Sorting and Divide and Conquer. Lecture 1 Introduction to Algorithm and Sorting.
Recurrences The expression: is a recurrence. –Recurrence: an equation that describes a function in terms of its value on smaller functions BIL741: Advanced.
Fast Fourier Transform Irina Bobkova. Overview I. Polynomials II. The DFT and FFT III. Efficient implementations IV. Some problems.
Advanced Counting Techniques CSC-2259 Discrete Structures Konstantin Busch - LSU1.
Dynamic Programming. Well known algorithm design techniques:. –Divide-and-conquer algorithms Another strategy for designing algorithms is dynamic programming.
Copyright © 2007 Pearson Addison-Wesley. All rights reserved. A. Levitin “ Introduction to the Design & Analysis of Algorithms, ” 2 nd ed., Ch. 1 Chapter.
Project 2 due … Project 2 due … Project 2 Project 2.
1 Designing algorithms There are many ways to design an algorithm. Insertion sort uses an incremental approach: having sorted the sub-array A[1…j - 1],
5.6 Convolution and FFT. 2 Fast Fourier Transform: Applications Applications. n Optics, acoustics, quantum physics, telecommunications, control systems,
The Fast Fourier Transform
Karatsuba’s Algorithm for Integer Multiplication
Applied Symbolic Computation1 Applied Symbolic Computation (CS 300) Karatsuba’s Algorithm for Integer Multiplication Jeremy R. Johnson.
Advanced Counting Techniques CSC-2259 Discrete Structures Konstantin Busch - LSU1.
The Fast Fourier Transform and Applications to Multiplication
Motivation: Wavelets are building blocks that can quickly decorrelate data 2. each signal written as (possibly infinite) sum 1. what type of data? 3. new.
CSS106 Introduction to Elementary Algorithms M.Sc Askar Satabaldiyev Lecture 05: MergeSort & QuickSort.
Computer Science 101 A Survey of Computer Science QuickSort.
Divide and Conquer Andreas Klappenecker [based on slides by Prof. Welch]
Divide and Conquer Strategy
1 How to Multiply Slides by Kevin Wayne. Copyright © 2005 Pearson-Addison Wesley. All rights reserved. integers, matrices, and polynomials.
 Design and Analysis of Algorithms تصميم وتحليل الخوارزميات (311 عال) Chapter 2 Sorting (insertion Sort, Merge Sort)
May 9, 2001Applied Symbolic Computation1 Applied Symbolic Computation (CS 680/480) Lecture 6: Multiplication, Interpolation, and the Chinese Remainder.
CMPT 238 Data Structures More on Sorting: Merge Sort and Quicksort.
Equal costs at all levels
Introduction to Algorithms: Divide-n-Conquer Algorithms
Divide and Conquer.
Subject Name: Design and Analysis of Algorithm Subject Code: 10CS43
Chapter 2 Divide-and-Conquer algorithms
Lecture 5 Dynamic Programming
Unit 1. Sorting and Divide and Conquer
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
Chapter 4: Divide and Conquer
Polynomial + Fast Fourier Transform
Lecture 4 Divide-and-Conquer
Chapter 4 Divide-and-Conquer
Applied Symbolic Computation
Divide and Conquer.
CS 3343: Analysis of Algorithms
Lecture 5 Dynamic Programming
CSCE 411 Design and Analysis of Algorithms
CS 3343: Analysis of Algorithms
CS 3343: Analysis of Algorithms
FAST FOURIER TRANSFORM ALGORITHMS
DFT and FFT By using the complex roots of unity, we can evaluate and interpolate a polynomial in O(n lg n) An example, here are the solutions to 8 =
Unit-2 Divide and Conquer
Ch 4: Recurrences Ming-Te Chi
Algorithms Dr. Youn-Hee Han April-May 2013
Divide and Conquer Neil Tang 4/24/2008
Trevor Brown CS 341: Algorithms Trevor Brown
Divide & Conquer Algorithms
Divide and Conquer Merge sort and quick sort Binary search
Presentation transcript:

Instructor: Shengyu Zhang 1

Example 1: Merge sort 2

Starting example 3

An algorithm: merge sort 4

Complexity? 5

How to solve/bound this recurrence relation? 6

A general method for designing algorithm: Divide and conquer Breaking the problem into subproblems  that are themselves smaller instances of the same type of problem Recursively solving these subproblems Appropriately combining their answers 7

Complexity 8

Master theorem 9

10

Example 2: Selection 11

Selection 12

Idea of divide and conquer 13

Pivot 14

After the partition 15

Divide and conquer 16

17

18

19

20

21

Example 3: Matrix multiplication 22

Matrix multiplication 23

24

25

26

27

God knows how he came up with it. And here is how: where 28

29

30

Fast Fourier Transform (FFT) 31

Multiplication of polynomials 32

Multiplication 33

Better? YES! 34

What determines/represents a polynomial? 35

Reason 36

unknowns 37

Advantage of point-value representation? 38

Go to an easy world and come back HK used to have many industries. Later found mainland has less expensive labor. So:  moved the companies to mainland,  did the work there,  and then shipped the products back to HK to sell This is worth doing if: it’s cheaper in mainland, and the traveling/shipping is not expensive either.  which turned out to be true. 39

In our case We need to investigate: the cost of traveling.  Both way. 40

Traveling 41

Evaluation 42

Number of points 43

44

Complex roots of unity

All the essences are here… 46

Distinct points 47

48

Interpolation 49

50

51

Or 52

Summary Divide and conquer is a general method to design algorithms. Master theorem to compute the complexity. Several examples.  Merge sort  Selection  Matrix multiplication  FFT 53