18.04.2013 Views

The.Algorithm.Design.Manual.Springer-Verlag.1998

The.Algorithm.Design.Manual.Springer-Verlag.1998

The.Algorithm.Design.Manual.Springer-Verlag.1998

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Lecture 12 - introduction to dynamic programming<br />

Multiplying an matrix by a matrix (using the common algorithm) takes<br />

multiplications.<br />

We would like to avoid big intermediate matrices, and since matrix multiplication is associative, we can<br />

parenthesise however we want.<br />

Matrix multiplication is not communitive, so we cannot permute the order of the matrices without<br />

changing the result.<br />

Listen To Part 12-12<br />

Example<br />

Consider , where A is , B is , C is , and D is .<br />

<strong>The</strong>re are three possible parenthesizations:<br />

<strong>The</strong> order makes a big difference in real computation. How do we find the best order?<br />

Let M(i,j) be the minimum number of multiplications necessary to compute .<br />

<strong>The</strong> key observations are<br />

● <strong>The</strong> outermost parentheses partition the chain of matricies (i,j) at some k.<br />

● <strong>The</strong> optimal parenthesization order has optimal ordering on either side of k.<br />

Listen To Part 12-13<br />

A recurrence for this is:<br />

file:///E|/LEC/LECTUR16/NODE12.HTM (4 of 9) [19/1/2003 1:34:58]

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

Saved successfully!

Ooh no, something went wrong!