Monday, June 26, 2006

Insight into DP & BFS

Hmmm, thanks to two nice problems, I got some valuable reading of Dynamic Programming and Breadth First Search [Trees].

562. Dividing Coins
I did this program, I didnt even use recursion, yet I think the technique is called Dynamic Programming. From Cormen, I found out that the problem is similar to 0-1 Knapsack problem, and Shalin Bhaiya confirmed the same. However, I think the method I followed made the problem even simpler than 0-1 Knapsack.

439. Knight Moves
This was the TKP problem I was talking about. Used a BFS algo, but however, I didnt exactly use a tree. I used a queue instead. I wonder what is the method I used.. I mean whether what I did comes under DP or not, whether it is indeed BFS or not... Anyway, having done this program gives me tremendous confidence!

2 comments:

Sauc said...

hey. it wud be good if u study the things in order. that i ha told u.same as given in corman

Anonymous said...

Nice idea with this site its better than most of the rubbish I come across.
»