• <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
            <2025年5月>
            27282930123
            45678910
            11121314151617
            18192021222324
            25262728293031
            1234567

            常用鏈接

            留言簿(2)

            隨筆檔案

            文章檔案

            網頁收藏

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜


            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 鷹擊長空 閱讀(180) 評論(0)  編輯 收藏 引用
            伊人久久大香线蕉成人| 久久久久久A亚洲欧洲AV冫| 久久青青草原综合伊人| 久久精品国产亚洲AV麻豆网站| 久久亚洲精品国产精品| 国产精品无码久久久久| 2021最新久久久视精品爱 | 久久男人Av资源网站无码软件| 久久久一本精品99久久精品66| 精品久久久久久久久久久久久久久| 伊人久久大香线蕉无码麻豆| 99久久超碰中文字幕伊人| 久久精品无码一区二区三区免费| 亚洲国产精品无码久久久蜜芽| 91久久福利国产成人精品| 无码人妻精品一区二区三区久久| 伊人久久精品线影院| 国内精品久久久久久久97牛牛| 国产精品中文久久久久久久| 久久久久久狠狠丁香| 精品久久久久久无码中文字幕一区| 思思久久精品在热线热| 国产免费久久精品99久久| 国产精品禁18久久久夂久| 亚洲精品无码成人片久久| 日韩欧美亚洲综合久久影院Ds| 国产亚洲色婷婷久久99精品91| 九九99精品久久久久久| 久久久亚洲欧洲日产国码二区| 97精品依人久久久大香线蕉97| 久久国产AVJUST麻豆| 一本一道久久a久久精品综合| 久久国产福利免费| 久久本道久久综合伊人| 国产农村妇女毛片精品久久| 久久免费视频网站| 久久精品无码免费不卡| 亚洲精品视频久久久| 一本大道久久东京热无码AV| 国产精品久久久久久五月尺| 精品久久久久久久久免费影院|