Jun-24-2020, 01:46 PM
(This post was last modified: Jun-24-2020, 01:46 PM by Ayman_2001.)
Is it really important to fully know Recursive functions to be able to be a good coder? This thing is eating up my head to be honest.
Recursive functions
|
||||
Jun-24-2020, 01:46 PM
(This post was last modified: Jun-24-2020, 01:46 PM by Ayman_2001.)
Is it really important to fully know Recursive functions to be able to be a good coder? This thing is eating up my head to be honest.
Jun-24-2020, 03:15 PM
I think it's a technique you should know, yes. Certain problems are expressed more naturally in terms of recursion (e.g. searching trees depth-first).
Jun-24-2020, 03:21 PM
(This post was last modified: Jun-24-2020, 03:30 PM by Gribouillis.)
Most programmers use recursion so often that it becomes second nature. To program recursive algorithms, simply program as if you already knew how to do something. For example
The problem is that the above algorithm never stops, we need to add a condition to avoid going into an infinite loop. For example we can add at the beginning:
| ||||
|