• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            隨筆 - 42  文章 - 3  trackbacks - 0
            <2009年7月>
            2829301234
            567891011
            12131415161718
            19202122232425
            2627282930311
            2345678

            常用鏈接

            留言簿(2)

            隨筆檔案

            文章檔案

            網(wǎng)頁收藏

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜


            Dynamic programming is similar to divide-and-conquer, it divide the original problem into small part, but they have different directions, Dynamic programming is bottom-up, while divide-and-conquer is a top-down approach. In this approach, we solve the small instance and store the result in a table, when we need the result, we just search in the table, and thus save large amount of time to re-calculation.

            The steps in the development of a dynamic programming algorithm are as follows:
            1. Establish a recursive property that gives the solution to an instance of the problem.

            2. Solve an instance of the problem in a bottom-up fashion by solving smaller instances first.

            A famous applications of dynamic programming is Floyd's Algorithm for Shortest Paths.

            Using dynamic programming, we create a cubic-time algorithm for the Shortest Paths problem. First we develop an algorithm that determines only the lengths of the shortest paths. After that we modify it to produce shortest paths as well. We represent a weighted graph containing n vertices by an array W where

            Image from book

            The array D in Figure 3.3 contains the lengths of the shortest paths in the graph. For example, D[3][5] is 7 because 7 is the length of a shortest path from v3 to v5. If we can develop a way to calculate the values in D from those in W, we will have an algorithm for the Shortest Paths problem. We accomplish this by creating a sequence of n + 1 arrays D(k), where 0 k n and where

            Image from book
            Figure 3.3: W represents the graph in Figure 3.2 and D contains the lengths of the shortest paths. Our algorithm for the Shortest Paths problem computes the values in D from those in W.
            • D(k)[i][j] = length of a shortest path from vi to vj using only vertices in the set {v1, v2, , vk} as intermediate vertices.

            Therefore, to determine D from W we need only find a way to obtain D(n) from D(0). The steps for using dynamic programming to accomplish this are as follows:

            1. Establish a recursive property (process) with which we can compute D(k) from D(k-1).

            2. Solve an instance of the problem in a bottom-up fashion by repeating the process (established in Step 1) for k = 1 to n. This creates the sequence

            Dynamic programming algorithm provides a solution for an optimization problem, and the steps in the development of such an algorithm are as follows:

            1. Establish a recursive property that gives the optimal solution to an instance of the problem.

            2. Compute the value of an optimal solution in a bottom-up fashion.

            3. Construct an optimal solution in a bottom-up fashion.

            Steps 2 and 3 are ordinarily accomplished at about the same point in the algorithm.

            The principle of optimality is said to apply in a problem if an optimal solution to an instance of a problem always contains optimal solutions to all substances.

            posted on 2012-03-27 18:48 鷹擊長空 閱讀(184) 評論(0)  編輯 收藏 引用

            只有注冊用戶登錄后才能發(fā)表評論。
            網(wǎng)站導(dǎo)航: 博客園   IT新聞   BlogJava   博問   Chat2DB   管理


            国产精品一区二区久久不卡| 久久婷婷五月综合色高清| 久久偷看各类wc女厕嘘嘘| 色综合久久久久综合体桃花网| 亚洲va中文字幕无码久久| 久久国产亚洲精品无码| 国产精品99久久精品爆乳| Xx性欧美肥妇精品久久久久久| 色婷婷噜噜久久国产精品12p| 久久婷婷色综合一区二区| 国内精品久久久久影院优| 久久一本综合| 999久久久无码国产精品| 性高湖久久久久久久久AAAAA| 亚洲精品无码久久久久| 久久久久久免费一区二区三区| 久久毛片一区二区| 久久99国产精品久久| 久久天天躁夜夜躁狠狠| 色综合久久最新中文字幕| 亚洲精品乱码久久久久久蜜桃不卡| 中文字幕久久欲求不满| 无码AV波多野结衣久久| 性做久久久久久久久久久| 爱做久久久久久| 超级碰久久免费公开视频| 国产婷婷成人久久Av免费高清| 四虎国产精品成人免费久久| 久久e热在这里只有国产中文精品99 | 久久精品国产99久久久| 女人高潮久久久叫人喷水| 欧美粉嫩小泬久久久久久久| 精品一区二区久久| 国产日产久久高清欧美一区| 久久久久久久人妻无码中文字幕爆| 伊人热热久久原色播放www| 久久综合色之久久综合| 久久亚洲av无码精品浪潮| 性做久久久久久久久| 一级女性全黄久久生活片免费 | 91久久婷婷国产综合精品青草|