DEV Community

Discussion on: Recursion Demystified: Think Recursively

Collapse
 
katafrakt profile image
Paweł Świątkowski • Edited

I remember when I was taught at the university they first showed us what is recursion just to immediately show us how inefficient it is (using the Fibonacci example you use in the post ;) ). This can create strong negative connotation for the concept and maybe this is why people tend to avoid it. However, I don't know if it is taught like that everywhere.

Also, it's a common trick question on interviews - something that seems to be easily solvable in a recursive way, but uses just too many resources and crashes. Same with all these leetcode competitions. Perhaps because of that people tend to shy away from recursion.

Good things there are article like this one, showing it's a useful concept (and not only useful, but even required, in functional programming).

Collapse
 
emma_donery profile image
Emma Donery

"Of all ideas i have introduced to children, recursion stands out as the one idea that is particularly able to evoke an excited response.

  • Seymour Papert This quote made me realize how exciting recursion can get. If you master the art, you become the master, right?...I believe there are many ways to solve problems without using recursion but where recursion applies, it is remarkable(clean code)