分治法,贪心算法,动态规划算法总结(斯坦福算法课Algorithms:Design and Analysis Part2)

动态规划是优化的分治,贪心的局部最优可能达成全局最优,而动规的最优值中不一定全是局部最优。

一. 分治法 :

1. divide and conquer , solve the problems by dividing it into two halves, solve the two halves, and put the solution together.
2. 通常是 top down paradigm

** 应用 **
    mergesort:应用到递归
    Binary search tree:应用到递归

二. 贪心算法:

1. 贪心选择性质 
2.  最优子结构 
3. 通常是Bottem up paradigm

** 应用 **
   Prim’s algorithm  { 每次选择距离当前生成树最近的节点}
   Dijkstra algorithm { 每次选择距离source vertice 最近的节点}
   Scheduling application  { weight/length }
   Huffman codes (prefix-free codes) { 每次选择两个frequency最小的alphabet }

三. 动态规划:

1. 重叠子问题
2. 最优子结构
3. 步骤 :
    a) Identify a small number of subproblems
    b) Can quickly correctly solve “large” subproblems given the solutions to “smaller subproblems”
    (usually via a recurrence and the optimal solutions to a given subproblem is as a function 
    of  the optimal solutions to smaller subproblems)
    c) After solving all the sub problems, can quickly conpute the final solution
4. 细化步骤 :
    a) 假设optimal solution 成立
    b) 在假设成立的条件下,find the exactly several possibility of the last Item
    c) Analyse several situation of deleting the last item, find optimal substructure
    d) The recurrence 
       Brute force
       for {
             for {                        
                             {1.
                  A= min/max  2.
                              3.}
                }   
             }
    e) Implicit it from begin

** 应用 **:
   The knapsack problem
   Sequence alignment
   Optimal binary search trees

[1] 课程链接
[2] 我的博客

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值