Redian新闻
>
求推荐学习recursive 算法的资料
avatar
求推荐学习recursive 算法的资料# JobHunting - 待字闺中
f*m
1
对于recursive总是掌握不了,大家有什么比较好的这方面的学习资料推荐吗?
谢谢。
avatar
f*m
2
自己顶一个
avatar
h*e
3
不用专门练recursion的,还是多看多做题吧。有的题目recursive的解法
非常明显,难的反而是改成非recursive的,例如binary tree的遍历。
也有的题目recursive的解法不明显,但是最后做下来要比非recursive的
简洁。还有的题目硬用recursive反而不优。
DP的不少问题都可以用recursion来解,但是往往为了优化你还得改成
bottom-up的。不然你就多找些DP的问题来练练吧。
http://people.csail.mit.edu/bdean/6.046/dp/

【在 f*********m 的大作中提到】
: 自己顶一个
avatar
f*m
4
谢谢。马上就要面试,不知还来不来得及多看多做题啊。
avatar
h*e
5
面试不会只问你recursion的题吧。尽力而为吧。:)

【在 f*********m 的大作中提到】
: 谢谢。马上就要面试,不知还来不来得及多看多做题啊。
avatar
f*m
6
谢谢。希望如此吧。
avatar
p*2
8
recursion就是DFS。
avatar
f*m
9
"recursion就是DFS。"
这个心得恐怕需要做过很多题才能体会得到。
avatar
p*2
10

我们感觉DFS可以解决50%的面试题了。所以学好这个,面试题就解决一半了。:)

【在 f*********m 的大作中提到】
: "recursion就是DFS。"
: 这个心得恐怕需要做过很多题才能体会得到。

avatar
b*e
11
sort, link list, trees are great study cases for recursion.
For link list and trees, cuz these structures are defined recursively.
Sometimes, the recursive solution is more intuitive.
Only for linked list:
a few examples:
1: Get the length of the link list
2: Get the max/min value of linked list
3: Get the nth/last nth number of the list
4: Reverse linked list(There should be 2 recursive version, one with
carryover)
5: Sort linked list (this is hard)
6: Copy linked list
7: Delete a value in a sorted/unsorted linked list
8: Find a number in unsorted/sorted linked list
9: Insert a number in sorted linked list
10: Get the sum of linked list
These are simple coding problems, you can solve this non-recursively but
doing it recursively will get your hands warm.

【在 f*********m 的大作中提到】
: 对于recursive总是掌握不了,大家有什么比较好的这方面的学习资料推荐吗?
: 谢谢。

avatar
f*m
12
谢谢:)

【在 b********e 的大作中提到】
: sort, link list, trees are great study cases for recursion.
: For link list and trees, cuz these structures are defined recursively.
: Sometimes, the recursive solution is more intuitive.
: Only for linked list:
: a few examples:
: 1: Get the length of the link list
: 2: Get the max/min value of linked list
: 3: Get the nth/last nth number of the list
: 4: Reverse linked list(There should be 2 recursive version, one with
: carryover)

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。