开发者

Tree + Recursion

I came ac开发者_如何学Pythonross an article on Binary Trees Search . It uses intensive Recursive Algorithms.. I am just so confused with these stuff..

Please guide my path so as I understand these problems at ease, or any good website to read about recursion first and then solving these problems.. Please share your experience on it..

Its very urgent, and I want to learn these concepts as soon as possible.. Thankss...

Regards.


Trees are naturally recursive, because each subtree is itself a tree. That's a key idea that will be present in anything you do with trees.


Recursion is one of those concepts that most people have to study for a while and feel confused about for a while, and then they have an epiphany, and it all just makes sense. Afterward, they often have a hard time figuring out what seemed so confusing, or why, since it's all so obvious.

Unfortunately, it also seems hard to predict when that epiphany will happen, or what will trigger it. From what I've seen, more often than not it happens when somebody gets away from the computer and goes for a walk (or swim, bike ride, etc.)


A good book from which to learn recursion, which is driven by recursive descriptions of data structures (including lists and trees), is How to Design Programs, which is available free online.


One thing while understanding recursion is don't traverse every function call, because you will be lost.Human brain is not made for that and that's why we use computer. Just keep faith that it works. Keep these things in mind, What is exit condition i.e when you will come out of recursion and What is recursive logic it needs to process.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜