r/learnprogramming • • Apr 05 '22

Name one programming/comp sci concept you never understood and if you understand it, try to explain it to them

Name a programming concept such as virtual functions, pointers, certain algorithms, etc that you always had a hard time understanding and why.

Someone else who reads yours and does understand it, try to explain it to them to help them learn

1.6k Upvotes

738 comments sorted by

View all comments

255

u/ICantPCGood Apr 05 '22

Dynamic Programming, it’s just recursion with notes about what you’ve done already?

We covered it in a class with the only teacher I’ve ever truly called “bad” and then every teacher after just assumed we all knew it 🙃. Could never really grok it on my own or figure out how to apply it.

292

u/procrastinatingcoder Apr 05 '22

It generally refers to keeping a table of previous results, and re-using those for your next calculations. It's nothing special, and I find the term "dynamic" in dynamic programming to be the most misleading thing ever personally.

9

u/Select-Sir9364 Apr 05 '22

Is this table of previous results similar to memoization?

11

u/Drifts Apr 06 '22

my limited understanding is that it is exactly memoization

5

u/Unsounded Apr 06 '22

They’re actually two different concepts, dynamic programming is a bit more nuanced, and is defined as a problem being able to be solved by breaking down a larger problem set into a smaller one and the micro decisions being optimal in the sense that you can solve the sub problem and it doesn’t require context from outside the sub problem.

Memoization can help, and is used for some dynamic programming problems but it isn’t the same.