亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? mat_chain.html

?? Data Structure Ebook
?? HTML
字號:
<HTML><HEAD>
<TITLE>Data Structures and Algorithms: Matrix Chain Multiplication</TITLE>

<META name="description" content="Data Structures and Algorithms Course Notes,
PLDS210 University of Western Australia">
<META name="keywords" content="data structures,algorithms,abstract data types,
matrix chain multiplication, dynamic algorithms">
</HEAD>
<BODY BGCOLOR="#ffffff">
<TABLE BGCOLOR="#00c0f0" WIDTH="100%" CELLSPACING=0 CELLPADDING=0>
<TR BGCOLOR="#00f0f0"><TD ALIGN=right>
<FONT FACE=helvetica SIZE=+1><I>Data Structures and Algorithms</I></FONT>
</TD></TR>

<TR><TD><FONT FACE=helvetica SIZE=+2><B>Matrix Chain Multiplication</B></FONT>
</TD></TR>
</TABLE>
<P>
<H4>Problem</H4>
We are given a sequence of matrices to multiply:
<CENTER>
<B>
A<SUB>1</SUB>
A<SUB>2</SUB>
A<SUB>3</SUB>
...
A<SUB>n</SUB>
</B>
</CENTER>
Matrix multiplication is associative, so 
<CENTER>
<B>
A<SUB>1</SUB> ( A<SUB>2</SUB> A<SUB>3</SUB> ) =
( A<SUB>1</SUB> A<SUB>2</SUB> ) A<SUB>3</SUB> 
</B>
</CENTER>
that is, we can can generate the product in two ways.
<P>

The cost of multiplying an
<B><I>n</I></B><FONT FACE=helvetica,arial>x</FONT><B><I>m</I></B>
by an
<B><I>m</I></B><FONT FACE=helvetica,arial>x</FONT><B><I>p</I></B>
one is <B><I>O(nmp)</I></B> (or
<B><I>O(n</I><SUP>3</SUP><I>)</I></B> for two
<B><I>n</I></B><FONT FACE=helvetica,arial>x</FONT><B><I>n</I></B>
ones).
A poor choice of parenthesisation can be expensive:
<I>eg</I> if we have
<CENTER>
<TABLE>
<TR><TH>Matrix</TH><TH>Rows</TH><TH>Columns</TH></TR>
<TR><TD ALIGN=center><B>A<SUB>1</SUB></B></TD><TD ALIGN=center>10</TD><TD ALIGN=center>100</TD></TR>
<TR><TD ALIGN=center><B>A<SUB>2</SUB></B></TD><TD ALIGN=center>100</TD><TD ALIGN=center>5</TD></TR>
<TR><TD ALIGN=center><B>A<SUB>3</SUB></B></TD><TD ALIGN=center>5</TD><TD ALIGN=center>50</TD></TR>
</TABLE>
</CENTER>
the cost for 

<B>( A<SUB>1</SUB> A<SUB>2</SUB> ) A<SUB>3</SUB></B> is
<CENTER>
<TABLE>
<TR><TD><B>A<SUB>1</SUB>A<SUB>2</SUB> </TD><TD>10x100x5</TD><TD>= 5000</TD>
<TD>=> <B>A<SUB>1</SUB> A<SUB>2</SUB></B> (10x5)</TD></TR>
<TR><TD><B>(A<SUB>1</SUB>A<SUB>2</SUB>) A<SUB>3</SUB> </TD><TD>10x5x50</TD><TD>= 2500</TD>
<TD>=> <B>A<SUB>1</SUB>A<SUB>2</SUB>A<SUB>3</SUB></B> (10x50)</TD></TR>
<TR><TD> Total<TD>&nbsp;</TD><TD><FONT COLOR=red>&nbsp;&nbsp;7500</TD><TD>&nbsp;</TD></TR>
</TABLE>
</CENTER>
but for
<B>A<SUB>1</SUB> ( A<SUB>2</SUB> A<SUB>3</SUB> )</B>
<CENTER>
<TABLE>
<TR><TD><B>A<SUB>2</SUB>A<SUB>3</SUB> </TD><TD>100x5x50</TD><TD>= 25000</TD>
<TD>=> <B>A<SUB>2</SUB>A<SUB>3</SUB></B> (100x5)</TD></TR>
<TR><TD><B>A<SUB>1</SUB>(A<SUB>2</SUB>A<SUB>3</SUB>) </TD><TD>10x100x50</TD><TD>= 50000</TD>
<TD>=> <B>A<SUB>1</SUB>A<SUB>2</SUB>A<SUB>3</SUB></B> (10x50)</TD></TR>
<TR><TD> Total<TD>&nbsp;</TD><TD><FONT COLOR=red>&nbsp;&nbsp;75000</TD><TD>&nbsp;</TD></TR>
</TABLE>
</CENTER>
Clearly demonstrating the benefit of calculating the optimum order
before commencing the product calculation!

<H3>Optimal Sub-structure</H3>

As with the optimal binary search tree, we can observe that
if we divide a chain of matrices to be multiplied into two optimal
sub-chains:
<CENTER>
<B>
(A<SUB>1</SUB>
A<SUB>2</SUB>
A<SUB>3</SUB>
...
A<SUB>j</SUB>)
(A<SUB>j+1</SUB>
...
A<SUB>n</SUB>
)
</B>
</CENTER>
then the optimal parenthesisations of the sub-chains must be 
composed of optimal chains.
If they were not, then we could replace them with cheaper parenthesisations.
<P>
This property, known as <FONT COLOR="#fa0000"><B>optimal sub-structure</B></FONT>
is a hallmark of dynamic algorithms:
it enables us to solve the small problems (the sub-structure) and use those
solutions to generate solutions to larger problems.
<P>
For matrix chain multiplication, the procedure is now almost identical to
that used for constructing an optimal binary search tree.
We gradually fill in two matrices,
<UL><LI>one containing the costs of multiplying all the sub-chains.
The diagonal below the main diagonal contains the costs of all
pair-wise multiplications:
<TT>cost[1,2]</TT> contains the cost of generating product
<B>A<SUB>1</SUB>A<SUB>2</SUB></B>, <I>etc</I>.
The diagonal below that contains the costs of triple products:
<I>eg</I> <TT>cost[1,3]</TT> contains the cost of generating product
<B>A<SUB>1</SUB>A<SUB>2</SUB>A<SUB>3</SUB></B>, which we derived
from comparing <TT>cost[1,2]</TT> and <TT>cost[2,3]</TT>, <I>etc</I>.
<LI>one containing the index of last array in the left parenthesisation
(similar to the root of the optimal sub-tree in the optimal binary
search tree, but there's no root here - the chain is divided into
left and right sub-products), so that 
<TT>best[1,3]</TT> might contain 2 to indicate that the
left sub-chain contains
<B>A<SUB>1</SUB>A<SUB>2</SUB></B> and the right one is
<B>A<SUB>3</SUB></B> in the optimal parenthesisation of
<B>A<SUB>1</SUB>A<SUB>2</SUB>A<SUB>3</SUB></B>.
</UL>
As before, if we have <B><i>n</I></B> matrices to multiply,
it will take <B><I>O(n)</I></B> time to generate each of the
<B><I>O(n<SUP>2</SUP>)</I></B> costs and entries in the
<TT>best</TT> matrix for an overall complexity of 
<B><I>O(n<SUP>3</SUP>)</I></B> time 
at a cost of
<B><I>O(n<SUP>2</SUP>)</I></B> space.

<H3>Animation</H3>

<A NAME=mat_chain_anim>
<TABLE BGCOLOR="#00f0f0" WIDTH="100%"> 
<TR><TD >
<FONT COLOR=blue FACE=helvetica>
<B>Matrix Chain Multiplication Animation</B><BR>
This animation was written by Woi Ang.</FONT></TD>
<TD ALIGN=center>
  <TABLE BORDER=0>
  <TR><TD>
    <applet CODEBASE="tppjava" tppabs="http://www.ee.uwa.edu.au/~plsd210/ds/Java/matmult/" code = "AlgAnimApp.class" tppabs="http://www.ee.uwa.edu.au/~plsd210/ds/Java/matmult/AlgAnimApp.class" width = 200 height = 35>
    <param name = "filename" value = "AlgThread.java">
    <param name = "buttonname" value = "Run the Animation">
    <param name = "algname" value = "Matrix Chain Multiplication">
		<param name = "algfile" value = "graph.dij">
    </applet>
    </TD>
  </TR>
</TABLE>
</TD>
<TD><FONT FACE=helvetica>Please email comments to:<BR>
<A HREF=mailto:morris@ee.uwa.edu.au>morris@ee.uwa.edu.au</A>
</TR>
</TABLE>


<P>
<TABLE WIDTH="100%" >
<TR><TD BGCOLOR="#00c0f0"><FONT FACE=helvetica,arial SIZE=+2><B>Key terms</B></TD></TR>
<TR>
<TD>
<DL>
<DT><FONT COLOR="#fa0000"><B>optimal sub-structure</B></FONT>
   <DD>a property of optimisation problems in which the sub-problems
       which constitute the solution to the problem itself are themselves
       optimal solutions to those sub-problems.
       This property permits the construction of dynamic algorithms to
       solve the problem.
</DL>
</TD></TR>
</TABLE>

<P>

<TABLE CELLPADDING=5 WIDTH="100%" BGCOLOR="#00f0f0" CELLSPACING=4>
<TR><TD WIDTH=50%>
Continue on to <A HREF="lcom_subseq.html" tppabs="http://www.ee.uwa.edu.au/~plsd210/ds/lcom_subseq.html">Longest Common Subsequence</A></TD>
<TD>Back to the <A HREF="ds_ToC.html" tppabs="http://www.ee.uwa.edu.au/~plsd210/ds/ds_ToC.html">Table of Contents</A>
</TD></TR></TABLE>
<SMALL>
&copy; <A HREF=mailto:morris@ee.uwa.edu.au>John Morris</A>, 1998
</SMALL>
</BODY>
</HTML>

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91福利社在线观看| 91视频在线观看免费| 国产日韩欧美一区二区三区乱码 | k8久久久一区二区三区 | 毛片基地黄久久久久久天堂| 一区二区三区在线看| 亚洲成人手机在线| 肉丝袜脚交视频一区二区| 免费成人av资源网| 国产99久久久国产精品| 91香蕉视频黄| 久久午夜电影网| 亚洲国产精品一区二区www在线| 免费的成人av| 色婷婷亚洲一区二区三区| 日韩欧美国产综合在线一区二区三区| 久久青草欧美一区二区三区| 亚洲欧美一区二区三区久本道91| 日韩av在线免费观看不卡| 精品一区二区日韩| 欧美日韩久久久| 亚洲欧洲www| 处破女av一区二区| 久久婷婷一区二区三区| 99国产精品99久久久久久| 欧美成人vps| 蜜桃视频免费观看一区| 欧美性欧美巨大黑白大战| 亚洲精品中文字幕在线观看| 99久久99久久精品免费看蜜桃| 久久亚洲综合色| 国产一区二区三区精品欧美日韩一区二区三区 | 亚洲自拍偷拍av| 欧美在线免费观看亚洲| 夜夜亚洲天天久久| 97国产精品videossex| 日韩美女精品在线| 色狠狠一区二区| 亚洲大尺度视频在线观看| 欧美艳星brazzers| 五月天一区二区| 日韩视频一区二区| 国产一级精品在线| 国产欧美一区二区三区网站| 成人国产精品免费观看视频| 中文字幕中文字幕在线一区 | 亚洲欧洲成人av每日更新| 91成人免费电影| 久久精品国产第一区二区三区| 亚洲精品一区二区三区在线观看 | 精品人在线二区三区| 国产91精品精华液一区二区三区| 欧美极品少妇xxxxⅹ高跟鞋| 日韩精品一区二区三区视频播放 | 亚洲bt欧美bt精品777| 91麻豆精品国产91久久久久久久久| 国产乱人伦精品一区二区在线观看| 国产精品美女www爽爽爽| 欧美综合欧美视频| 国产91丝袜在线18| 亚洲一区二区三区自拍| 国产清纯在线一区二区www| 欧美色图天堂网| 色婷婷综合五月| 成人免费毛片a| 国产一区二区电影| 免费看黄色91| 亚洲高清视频在线| 亚洲久本草在线中文字幕| 中文文精品字幕一区二区| 日韩欧美一区二区免费| 欧美成人一区二区三区| 欧美精品亚洲二区| 欧美另类久久久品| 欧美精品一级二级| 精品美女一区二区| 精品久久久久久久久久久久包黑料| 欧美日韩国产天堂| 欧美卡1卡2卡| 日韩亚洲电影在线| 日韩一区二区三区在线| 欧美一区二区三区成人| 91精品国产免费久久综合| 日韩欧美国产麻豆| 国产欧美一区在线| 中文字幕一区免费在线观看| 日韩一区中文字幕| 亚洲综合色自拍一区| 毛片av一区二区| 国产精品456露脸| www.在线欧美| 91电影在线观看| 日韩欧美一级二级三级久久久| 国产午夜亚洲精品午夜鲁丝片| 国产精品日产欧美久久久久| 亚洲三级视频在线观看| 亚洲主播在线观看| 国产精一区二区三区| 欧美在线免费观看视频| 日韩一卡二卡三卡四卡| 日韩一区有码在线| 激情综合色播激情啊| 欧美在线视频全部完| 日韩欧美综合在线| 亚洲男人的天堂在线观看| 精品亚洲欧美一区| 欧美日韩精品免费观看视频| 国产目拍亚洲精品99久久精品| 五月激情综合色| 91美女福利视频| 中文字幕av一区二区三区高| 奇米精品一区二区三区在线观看| 91 com成人网| 一区二区高清免费观看影视大全 | 91麻豆精品秘密| 久久精品视频一区二区三区| 午夜亚洲福利老司机| av亚洲精华国产精华精华| 久久久亚洲高清| 久久99精品久久久| 国产亚洲一区二区在线观看| 韩国理伦片一区二区三区在线播放| 日韩欧美色综合| 麻豆91精品视频| 精品国产a毛片| 国产suv精品一区二区883| 日本一区二区久久| 丝袜美腿亚洲色图| 色视频欧美一区二区三区| 九九**精品视频免费播放| 久久久久国产精品人| caoporen国产精品视频| 亚洲sss视频在线视频| 国产亚洲女人久久久久毛片| 色美美综合视频| 久久99精品久久只有精品| 欧美精彩视频一区二区三区| 日本韩国精品在线| 国产成人一级电影| 一区二区三区美女| 国产精品久久久久久久浪潮网站| 欧美性猛交xxxx黑人交| gogo大胆日本视频一区| 国产在线一区观看| 久久超碰97人人做人人爱| 亚洲色图都市小说| 日韩欧美在线综合网| 成人精品国产一区二区4080| 午夜精品福利视频网站| 国产精品欧美综合在线| 欧美精品精品一区| 色婷婷久久久久swag精品| 国产一区高清在线| 亚洲一区二区欧美| 国产精品久久一级| 精品88久久久久88久久久| 欧美日韩三级一区二区| 99国产精品视频免费观看| 国产成人亚洲综合a∨婷婷| 天天色天天操综合| 亚洲一区精品在线| 亚洲人成影院在线观看| 久久精品一区二区三区不卡| 欧美一区二区视频网站| 欧美丝袜丝交足nylons图片| 91免费观看在线| 91亚洲国产成人精品一区二区三| 国产成人综合在线观看| 精品一区二区三区视频在线观看| 午夜精品免费在线| 视频一区免费在线观看| 亚洲v中文字幕| 亚洲国产精品视频| 日韩不卡手机在线v区| 久久电影网电视剧免费观看| 美腿丝袜一区二区三区| 日本va欧美va精品| 久久超碰97人人做人人爱| 狠狠色丁香婷综合久久| 国产精品一区二区三区四区 | 成人国产精品免费观看| 色老头久久综合| 日韩一级片在线播放| 国产精品久久久久天堂| 一区二区视频在线看| 免费成人你懂的| 波多野结衣一区二区三区| 欧美午夜精品电影| 久久久久久久av麻豆果冻| 亚洲宅男天堂在线观看无病毒| 日本不卡一区二区三区| 国产成人福利片| 欧美二区三区91| 欧美国产一区在线| 天堂一区二区在线| 成人av集中营| 26uuu精品一区二区在线观看| 亚洲欧美在线高清| 国产激情视频一区二区三区欧美 | 免费欧美在线视频|