You may also like
最近才捡起的算法设计与分析.分析不准确的地方谅解,请各位看官指正. 1. 分治法与动态规划主要共同点: 二者都要求原问题具有最优子结构性质,都是将原问题分而治之,分解成若干个规模较小(小到很容易解决的程序)的子问题.然后将子问题的解合并,形成原问题的解. 2. 分治法与动态规划实现方法: ① 分治法通常利用递归求解. ② 动态规划通常利用迭代法自底向上求解,但也能用具有记忆功能的递归法自顶向下求解. 3. 分治法与动态规划主要区别: ① 分治法将分解后的子问题看成相互独立的. ② 动态规划将分解后的子问题理解为相互间有联系,有重叠部分. 例如: 在求解斐波那契数列过程中,求解fibonacci(5)时,得求解fibonacci(4)和fibonacci(3).其中,求解fibonacci(4)时,需要求解fibonacci(3). 在分治法中,求解完fibonacci(4)后还得重新求解fibonacci(3),即使求解fibonacci(4)子问题的时候已经求解过,也就是说,求解了二次子问题fibonacci(3). 动态规划为了避免类似子问题fibonacci(3)的重复求解,将已经求解过的子问题的解保存下来,在需要的时候将解值取出来,省去子问题解的重复求解过程. 4. 分治法与动态规划适用条件: […]
Add an asynchronous message handler to accept NDK library’s socket connection status callback for RTSPPlayer. I’m not so familiared with messages mechenism, […]
Planning to write a series of posts about debugging & trouble shooting tricks. And I’d like to make backtrace as a start. […]
↑ Introduction Streaming relays and reflectors can be used to scale streaming infrastructure by distributing load between servers and making the most […]