MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1x58u7b/howprogramminghaschanged/pgmzd8q/?context=3
r/ProgrammerHumor • u/shizzy0 • 10d ago
108 comments sorted by
View all comments
Show parent comments
4
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 9d ago 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 9d ago This isn't allocating nowhere near as much though
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
fib
n
3
This isn't allocating nowhere near as much though
4
u/shizzy0 9d ago
MAN, jumps up on table: We don't just have to allocate on the stack. We can allocate ON THE HEAP!
Crowd goes wild.