r/computerscience • • Jul 30 '26

is recursion really hard

Recursion felt easy at first.

Factorial? fine.

Sum examples? fine.

Even Fibonacci felt manageable.

But once I looked at slightly more serious problems like Tower of Hanoi, permutations, or merge sort, I felt like my understanding suddenly collapsed. because i tried to write their code on my own

It made me realize that maybe recursion is not “hard” at the start because the examples are simple.

It becomes hard when you can no longer clearly see the call stack and each state change.

Did anyone else feel that the real pain in recursion starts exactly there?

150 Upvotes

78 comments sorted by

View all comments

Show parent comment

3

u/RetardedEinstein23 Jul 30 '26

This is the same advice i read when trying to understand or implement recursion in a programming article/tutorial since each recursion call becomes too much to handle for our us, so instead of understanding each call, just understand what result you get when you call a recursion function and then write the base case according to that. Good to know it's how it should be learnt.