当前位置:网站首页>Tabulation v.s. Recursion With Memory (Dynamic Programming)
Tabulation v.s. Recursion With Memory (Dynamic Programming)
2022-06-12 01:19:00 【Yangsier】
Question
DP vs Recursion with memorization
I am wondering if that for any recursive function that can be translated into dynamic programming, is it always possible to also simply leave the function in its recursive form and apply a memorise wrapper to it as well? While we have clearly been shown there are many benefits to turning something into dynamic programming, I feel like some functions may be a lot easier to understand if they are in a recursive form and using a memorise function should help keep running costs low.
Such as the example in lecture 17 with seam carving, in my mind it would be considerably easier to understand what a function was doing if it worked backwards from the end point and recursively found the best path to that point, all why keeping running costs low due to a memorise wrapper.
My Answer
In my opinion, the bottom-up method and the top-down with memory (or recursive with memory) are quite similar methods (or they wouldn’t be classified as dynamic programming together).
- They both keep something in a list (maybe dimension higher than 1)
- They both cut off the calculated recursion tree. Make sure recursion runs under polynomial-time.
The difference between them is the way they fulfill the memory space and how they cut the recursion tree.
top-down with memory | bottom-up |
|---|---|
generate data in memory in a passive way | generate data in memory in an active way |
when recursion algorithms visit a node, we store information | when we visit nodes in whatever order we like and then store information |
when visiting a stored node, we call its value from memory | after observing the pattern of whole memory, we go through all nodes without repeatation |
we compute while storing information while cutting redundant trees | we fulfill memory, then we find a way to cut redundant trees, and finally, we compute |
Hope this comparison table can help you with understanding.
(By the way, I think memory decorator is easier to understand and much more to implement too.)
边栏推荐
- Kill, pkill, killall, next, what I brought to you in the last issue is how to end the process number and rush!
- Lambda quick start
- Unity顶点动画的阴影实现
- VsCode - 保存文件自动格式化将单引号 ‘ 变成双引号 “ 的问题
- Virtual human appears on the stage of the Winter Olympic Games, connecting elements of the meta universe
- Lambda intermediate operation sorted
- [answer] what does UML use to represent hexagonal architecture
- Weekly CTF 第一周:神奇的磁带
- 网狐游戏服务器-房间配置向导-组件属性与基本配置赋值
- 手写MapReduce程序详细操作步骤
猜你喜欢
随机推荐
2022-06-11:注意本文件中,graph不是邻接矩阵的含义,而是一个二部图。 在长度为N的邻接矩阵matrix中,所有的点有N个,matrix[i][j]表示点i到点j的距离或者权重, 而在二部
Lambda intermediate operation filter
人们对于产业互联网的这样一种认识的转变,并不是一蹴而就的
打造Flutter高性能富文本编辑器——渲染篇
【ROE】(2)ROE协议
中创专利|中国5G标准必要专利达1.8万项,尊重知识产权,共建知识产权强国
Lambda创建流
Forecast report on market demand and future prospect of cvtf industry of China's continuously variable transmission oil
Intel trimbert: tailor Bert for trade-offs
VM tools fail in VMware? Install VM tools using Ali image source
Kill session? This cross domain authentication solution is really elegant
Lambda intermediate operation map
New knowledge: monkey improved app crawler
Recursive and non recursive transformation
Data visualization big screen - big screen cloud minimalist user manual
给你一个项目,你将如何开展性能测试工作?
Article 5: Design of multi-functional intelligent trunk following control system | undergraduate graduation design - [learning of controller arduino+stm32]
Research Report on development status and investment suggestions of o-tert-butyl cyclohexyl acetate Market in the world and China 2022-2028
[project training] wechat official account to obtain user openid
一看就懂的JMeter操作流程








