关于DP算法的讨论
来源:互联网 发布:苹果wifi防蹭网软件 编辑:程序博客网 时间:2024/04/29 20:30
通常可以使用DP算法解决的问题有两个特点:
There are two key attributes that a problem must have in order for dynamic programming to be applicable: optimal substructure and overlapping subproblems which are only slightly smaller. When the overlapping problems are, say, half the size of the original problem the strategy is called "divide and conquer" rather than "dynamic programming". This is why mergesort, quicksort, and finding all matches of a regular expression are not classified as dynamic programming problems. 一般把DP算法分为两类:
- Top-down approach: This is the direct fall-out of the recursive formulation of any problem. If the solution to any problem can be formulated recursively using the solution to its subproblems, and if its subproblems are overlapping, then one can easily memoize or store the solutions to the subproblems in a table. Whenever we attempt to solve a new subproblem, we first check the table to see if it is already solved. If a solution has been recorded, we can use it directly, otherwise we solve the subproblem and add its solution to the table.
- Bottom-up approach: This is the more interesting case. Once we formulate the solution to a problem recursively as in terms of its subproblems, we can try reformulating the problem in a bottom-up fashion: try solving the subproblems first and use their solutions to build-on and arrive at solutions to bigger subproblems. This is also usually done in a tabular form by iteratively generating solutions to bigger and bigger subproblems by using the solutions to small subproblems. For example, if we already know the values of F41 and F40 (Fibonacci series), we can directly calculate the value of F42.
wikipedia here
- 关于DP算法的讨论
- 关于算法学习方法的讨论
- 关于Buddy(伙伴)算法的讨论
- 关于回溯剪枝算法的讨论
- 关于Buddy(伙伴)算法的讨论
- 关于Storm与JStorm的调度算法的讨论
- 关于Storm与JStorm的调度算法的讨论
- 关于素数判断算法优化方法的讨论
- 关于安卓无线定位与定位算法的讨论
- 知乎上对dp的讨论
- 关于checkpoint的讨论
- 关于checkpoint的讨论
- 关于比赛的讨论
- 关于工作流的讨论
- 关于C的讨论
- 关于时钟的讨论
- 关于单元测试的讨论
- 关于引用的讨论
- 浅析dev目录下设备文件mknod节点gid,uid和mode的如何方便设置
- PDA中数据流与图片转换
- 透明窗口
- Vmware上的使用管道接收串口输出
- wenxinqinglin 上传了资源:0915 Y系列大板(Y30S-96AT等) 22个频点显示正常 3分钟前
- 关于DP算法的讨论
- 根据def编译lib
- python 正則表達式
- 本地DNS缓存
- JPEG文件格式简单分析
- html 与xhtml制作网页的一些不同
- Windows Sockets
- 创建普通快捷方式和Internet快捷方式
- 代码行统计工具