12.07.2015 Views

A Practical Introduction to Data Structures and Algorithm Analysis

A Practical Introduction to Data Structures and Algorithm Analysis

A Practical Introduction to Data Structures and Algorithm Analysis

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Sec. 16.3 Numerical <strong>Algorithm</strong>s 555bot<strong>to</strong>m half with suitable sign changes on some rows <strong>and</strong> columns. Likewise for theleft <strong>and</strong> right halves. An efficient divide <strong>and</strong> conquer algorithm exists <strong>to</strong> performboth the evaluation <strong>and</strong> the interpolation in Θ(n log n) time. This is called theDiscrete Fourier Transform (DFT). It is a recursive function that decomposesthe matrix multiplications, taking advantage of the symmetries made available bydoing evaluation at the nth roots of unity. The algorithm is as follows.Fourier_Transform(double *Polynomial, int n) {// Compute the Fourier transform of Polynomial// with degree n. Polynomial is a list of// coefficients indexed from 0 <strong>to</strong> n-1. n is// assumed <strong>to</strong> be a power of 2.double Even[n/2], Odd[n/2], List1[n/2], List2[n/2];}if (n==1) return Polynomial[0];for (j=0; j

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!