MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1x58u7b/howprogramminghaschanged/pgmyup4/?context=3
r/ProgrammerHumor • u/shizzy0 • 2d ago
103 comments sorted by
View all comments
312
Both have terrible stack usage.
145 u/temperamentalfish 2d ago 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. 115 u/robin_888 2d ago 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. 3 u/TheThiefMaster 2d ago Tree iteration is pretty much the only time it's required, and even then you can linearise it if you have back links.
145
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.
115 u/robin_888 2d ago 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. 3 u/TheThiefMaster 2d ago Tree iteration is pretty much the only time it's required, and even then you can linearise it if you have back links.
115
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.
3 u/TheThiefMaster 2d ago Tree iteration is pretty much the only time it's required, and even then you can linearise it if you have back links.
3
Tree iteration is pretty much the only time it's required, and even then you can linearise it if you have back links.
312
u/torsten_dev 2d ago
Both have terrible stack usage.