DEV Community

Discussion on: What’s a concept you understand now, but took you forever to grasp?

Collapse
 
swarupkm profile image
Swarup Kumar Mahapatra

Recursion . I understand that recursion is where a function calls itself, until it doesn't.
But given a problem statement, transforming it to recursive program is still difficult to grasp.

I understand that recursion uses stack frames to load the function.
Hence I too solve such problems like DFS (Depth First Search) using stacks and for-loops

Collapse
 
lugodan profile image
Dan Lugo

I experienced the same as a CS student,lots of practice and use of recursion helped!

Collapse
 
drewhoo profile image
Drew Hoover

It took me so long to understand recursion, like 2-3 years before I felt comfortable thinking recursively. Making recursive solutions early on required just throwing shit at a wall and seeing what worked. Now it (recursion, not throwing shit at walls) is my favorite way to solve problems.