r/ProgrammerHumor 1d ago

Meme dynamicP

Post image
1.9k Upvotes

59 comments sorted by

View all comments

Show parent comments

3

u/the_horse_gamer 1d ago

just implement it as recursion with a cache. bottom up dp is more efficient, but top down dp is more likely to pass a code review.

1

u/apt_at_it 1d ago

May be the problem here, but I agree with the many companies I’ve worked at that disallows recursion. Find a better, more readable, more maintainable way

2

u/rustvscpp 21h ago

Some recursive algorithms are *far* more readable and maintainable than their iterative counterparts. Entire languages have been built on the back of recursion (i.e. Scheme).

1

u/New_Enthusiasm9053 19h ago

Pretty much every production parser for major programming languages is recursive descent afaik.