Using Recursion like a Pro - 1
YuehBen66
Posted on July 14, 2022
Why I write this post ?
In order to be a better programmer,
getting a dream software job,
all developers must face the devil call "Algorithms",
especially something called "Recursion" really showed me how DESPERATION looks like ๐ตโ๐ซ๐ตโ๐ซ๐ตโ๐ซ.
ย
After struggling for a while,
I search for "How to use Recursion comfortably",
and finally found a book called Think like a programmer.
ย
This book really SAVED MY LIFE !!! ๐ฅณ๐ฅณ๐ฅณ,
and now I can use Recursion pretty comfortably,
even able to solve the medium Tree problem within 10 mins,
which is extremely amazing !!!
ย
And I want to share you guys such amazing experience,
so you won't suffer from it.
ย
Prerequisite of being a Pro
Before becoming a recursion pro, let's review basics of recursion.
ย
Recursion
means "calling itself",
and it has 2 vital concepts,
which are Recurrence relation
and Base case
,
ย
- Recurrence relation :
the relationship between the problem and its direct
subproblems
- Base case :
the simplest case, which the function can handle on its own
without calling itself.
( if you're not familiar with these concepts, you can read the Martin and Dragon story )
ย
...to be continued
ย
References
Posted on July 14, 2022
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.