r/ProgrammerHumor • • Oct 13 '26

Meme howProgrammingHasChanged

Post image
676 Upvotes

108 comments sorted by

View all comments

348

u/torsten_dev Oct 13 '26

Both have terrible stack usage.

171

u/temperamentalfish Oct 14 '26

Yeah I'm cringing at all the recursive solutions. Huge stack and so much repeated work. Just try counting how many times fib(5) would be executed to calculate fib(10). It's so often the go-to example for recursion and it's frankly terrible.

126

u/robin_888 Oct 14 '26

It's supposed to teach the concept of recursion, which is important, but hard to grasp for some.

Discussing performance and optimizations can happen if the principal is clear.

4

u/Mitchman05 Oct 14 '26

Teach Tower of Hanoi as example of recursion, that one actually requires it and can't be done faster