摘要: https://blog.csdn.net/InNoVaion_yu/article/details/84975529 之前做过相关总结,再多说两句; 01背包必定是不能用贪心策略解决的。因为01背包选了就没有,而贪心则是可以选择多种; 对于01背包问题,只能用动态规划; 这里注意一下,最近遇到了关 阅读全文
posted @ 2020-02-24 18:17 暮云林凌 阅读(318) 评论(0) 推荐(0)
摘要: 基本思路: 典型的01背包问题; 关键点: 后续总结; #include<iostream> #include<stdlib.h> #include<stdio.h> #include<vector> #include<string> #include<math.h> #include<algori 阅读全文
posted @ 2020-02-24 17:42 暮云林凌 阅读(199) 评论(0) 推荐(0)
摘要: 之前做过相关总结,但是没有今天二次看的时候这么深入https://blog.csdn.net/InNoVaion_yu/article/details/84892297 经过自己这两天的理解和实践后,个人再对动态规划、贪心、DFS、递归的关系再做一个总结; 首先,DFS和贪心、递归的关系: DFS是 阅读全文
posted @ 2020-02-24 16:21 暮云林凌 阅读(441) 评论(0) 推荐(0)
摘要: 基本思想: 后续总结,详见数据结构典型问题——动态规划篇; #include<iostream> #include<stdlib.h> #include<stdio.h> #include<vector> #include<string> #include<math.h> #include<algo 阅读全文
posted @ 2020-02-24 10:54 暮云林凌 阅读(164) 评论(0) 推荐(0)
摘要: 基本思想: 后续动态规划问题总结,但是注意一点的是,初始化一定要使dp[i]=1,因为每个元素都可以独立的构成一个子串; 如果不初始化会有问题; 6 7 4 5 如果不初始化会有dp数组; 1 2 0 1 实际应该是: 1 2 1 2 关键点: 无; #include<iostream> #incl 阅读全文
posted @ 2020-02-24 10:17 暮云林凌 阅读(206) 评论(0) 推荐(0)
摘要: 基本思想关键点详见 “数据结构典型问题” #include<iostream> #include<stdlib.h> #include<stdio.h> #include<vector> #include<string> #include<math.h> #include<algorithm> #i 阅读全文
posted @ 2020-02-24 01:39 暮云林凌 阅读(151) 评论(0) 推荐(0)