views:

156

answers:

4

Im learning dynamic programming now, and while I know the theory well, designing DP algorithms for new problems is still difficult.

This is what i would really like now- A book or a website, which poses a problem which can be solved by dynamic programming. Also there is the solution with an explanation available, which i would like to see if i cant solve the problem even after butting my head at it for a few hours. Is there some resource that provides this sort of a thing for several categories of algorithms- like graph algorithms, dynamic programming, etc?

P.S. I considered Topcoder, but the solutions there are not really appropriate for learning to implement efficient solutions.

+3  A: 

Any of the ACM contest problem sets would probably work. Some places to find such:

Amber
Are solutions available for the UVA online judge?
Pranav
+1 - (so close to 10K!)
Dominic Rodger
+1 to help you be 10K+ :)
pierr
ACM contest problem sets is the way to go. You'll need to learn how to recognize the problems solvable through DP first, but then these sites are a very good resource.
laura
@Pranav - the second link there provides general explanations of how to solve the problem on each problem's page under the 'Explanation' heading (but doesn't give you an entire solution in code). @Dom/pierr - thanks! :) @laura - the second link actually notes what type each problem is, so the ones that are clearly dynamic programming problems are marked as such.
Amber
For DP specifically, http://www.algorithmist.com/index.php/Category:Dynamic_Programmingtips you off to a few problems in DP. =)
Larry
A: 

Many problems in Project Euler can be solved elegantly by using dynamic programming.

pierr
A: 

http://www.topcoder.com
Here you will find all types of questions of varying difficulty level.

Duleb
As i said- the solutions there are not really appropriate for learning to implement efficient solutions.
Pranav
@Pranav Yes some of the questions are not beginner level, but you need to start from somewhere.
Duleb
That not what i meant. The solutions there are quite inefficient and are just put together to solve the problem in the minimum possible time. Not easy to understand and definitely not a good guide for good programming practices.
Pranav
A: 

I disagree somewhat that the solutions on TopCoder are not examples of good practice. The solutions submitted by the top users are often very simple and not necessarily extremely efficient, just efficient enough. What really matters is that the code is very short, which makes it a lot easier to understand, especially if you don't already know the solution.

I don't recommend writing ordinary programs in the same style, but it can definitely teach you something about over-engineering. I've seen solutions in Java with custom iterators, comparators, etc. and they were much harder to understand, even if the algorithm itself was trivial.

I once read an essay by Paul Graham, where he states that programs with fewer tokens are easier to understand. TopCoder has convinced me that this is true, at least in some domains.

Jørgen Fogh