DEV Community

Cover image for Dynamic Programming vs Divide-and-Conquer

Dynamic Programming vs Divide-and-Conquer

Oleksii Trekhleb on June 15, 2018

Or Divide-and-Conquer on Steroids TL;DR In this article I’m trying to explain the difference/similarities between dynamic programing and divide an...
Collapse
 
mrbogomips profile image
Giovanni Costagliola

Implications of Memoization techniques had always recalled to me a sort of «Heisenberg Uncertainty Principle» applied to the Computability Theory Field, could state something such: S(n)T(n) >= \h.

It seems to me that you've be influenced by the same echo and you recognized something similar in this article:

  • DP wastes the Space for the benefit of the Time
  • (but) DC doesn't need to waste the space

Honestly, I can't figurate any other correlation.

Anyway thanks for sharing your thoughts 👍

Collapse
 
rickssss profile image
Rick

I thought this was a really great treatment of the subject matter. I consider myself pretty skilled in implementing very explicit DP solutions for interviews and such, as well as using it in practice when it is the right tool, but I probably would struggle to explain these two concepts in a clear way. After finishing school, definitions and explanations faded away even though the concept and intuition are still there.

One thing that helped me personally to distinguish DP and LP and other similar terms was learning about the origin of the name "dynamic programming". Conceptually I viewed the word programming to mean.... programming.... when it was coined to talk more about a broad idea of "programs" in a similar way to "schedules", something I didn't learn my first year of school. I'm sure you (the poster) knows this but for anyone else, I think it's also a a small but somehow useful distinction to know, as it helps un-muddy the waters a bit in your language and thinking.

Collapse
 
isaacleimgruber profile image
IsaacLeimgruber

Hmmm, DP is essentially memoization whereas DC is a way to split an instance into subinstances. I dont see how those two can be compared. You can have a function that is recursive and creates a single instance and use DP whereas DC makes no sense because there is a single instance. DP is all about learning from your mistakes and DC more about distributing tasks to decomplexify the big picture. I'm not sure they have anything in common to be honest