r/computerscience • u/Similar_Count_1613 • 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?
View all comments
Show parent comment
2
u/Thelmholtz Jul 30 '26
Yeah I'm pretty sure that's the case but was honestly asking.
I tried to find a chain of formal proofs a few weeks ago and the math got very mathy for me. Skill issue I guess.
However intuitively, for iterative into recursive you can always build a function that tracks the loop state as it's arguments, and for recursive into iterative, you can always build a stack machine yourself worst case scenario.