Re: [algogeeks] coloring problem Dynamic programming

2013-12-17 Thread kumar raja
Please elaborate the explanation, i want to understand it in detail. On 17 December 2013 11:36, Saurabh Paliwal saurabh.paliwa...@gmail.comwrote: I think that can be done by having 2 different values at every position in the answer matrix. One when the previous house is of same color and one

Re: [algogeeks] coloring problem Dynamic programming

2013-12-17 Thread atul anand
@saurabh : answer[i][j] = min(answer[i-1][t]) + colorvalue[t] where t varies from 1 to k except j. how this DP is taking care of the case where no adjacent house if of same color. what i understand from the DP is the following :- find minimum cost of coloring previous house with color t (

Re: [algogeeks] coloring problem Dynamic programming

2013-12-17 Thread atul anand
ohh shoots...my bad.got this condition wrong t varies from 1 to k except j. now got it :)..ignore my previous comment :) :) On Tue, Dec 17, 2013 at 11:47 PM, atul anand atul.87fri...@gmail.comwrote: @saurabh : answer[i][j] = min(answer[i-1][t]) + colorvalue[t] where t varies from 1 to