Hacker News new | past | comments | ask | show | jobs | submit login

That's not true. You can of course use DP for heuristic and approximation algorithms. There's an FPTAS for Knapsack using DP, for instance.



It is true. DP always deals with optimization. Just because my car has a radio, doesn't mean my car is a radio.


Well, perhaps you use different definitions than I do, but it should be obvious that it is possible to design an algorithm using dynamic programming that does not solve the problem optimally. By optimally here, I mean always output the optimal solution.

If you, by optimization mean that there's a function value you are maximizing or minimizing, than that's not true either, since Subset Sum and Hamiltonian path are canonical decision problems for which DP is used.

Heck, you can even take the standard TSP DP algorithm and, instead of looking at all possible "exit vertices" in linear time, look at a randomly chosen constant number of candidates, thereby reducing the running time by a factor n and getting a randomized heuristic function not guaranteed to give the optimal value.


Technically if you car is recent, it is a cell phone with wheels but I digress.

This reminds me of biologists bickering about what is or is not a gene, and endless snorefests of ontologists bickering about the semantics of a label on an edge in a graph.

It was not amusing then either.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: