r/ProgrammerHumor • • Oct 13 '26

Meme howProgrammingHasChanged

Post image
676 Upvotes

108 comments sorted by

View all comments

Show parent comment

4

u/shizzy0 Oct 14 '26

MAN, jumps up on table: We don't just have to allocate on the stack. We can allocate ON THE HEAP!

Crowd goes wild.

4

u/ZachAttack6089 Oct 14 '26

But if you allocate on the heap like this, then you get O(1) performance whenever you call fib again with an equal or lesser value of n :D

3

u/poshikott Oct 14 '26

This isn't allocating nowhere near as much though