Recursion usage | Sololearn: Learn to code for FREE!

+5

Recursion usage

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

4/5/2017 1:30:47 AM

Edward

5 Answers

New Answer

+11

Because recursion may sometimes be able to simplify tasks which can only be completed by utilising complicated loops, if done via iteration.

+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

+2

ok thanks that makes sense

+2

thanks man i will look at that

0

Recursion for me is just on point and easy to use