+ 5

Recursion usage

if recursion is supposedly more resource intensive than regular looping, what is the point of using/learning about recursion?

5th Apr 2017, 1:30 AM
Edward
5 Antworten
+ 11
Because recursion may sometimes be able to simplify tasks which can only be completed by utilising complicated loops, if done via iteration.
5th Apr 2017, 2:10 AM
Hatsy Rei
Hatsy Rei - avatar
+ 6
It depends on what the loop is doing. I like recursion cause it keeps things tidy, in a small and precise line of code. I suggest you take a look at functions that are not primitive recursive such as ackermann's function. https://www.youtube.com/watch?v=i7sm9dzFtEI https://www.saylor.org/site/wp-content/uploads/2011/06/Ackermann-Function.pdf
5th Apr 2017, 2:25 AM
Rrestoring faith
Rrestoring faith - avatar
+ 2
ok thanks that makes sense
5th Apr 2017, 2:13 AM
Edward
+ 2
thanks man i will look at that
5th Apr 2017, 2:22 AM
Edward
0
Recursion for me is just on point and easy to use
25th Jul 2017, 2:03 PM
Glen Mudau
Glen Mudau - avatar