<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Help with DP algorithm' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Help with DP algorithm' posted on the 'Algorithms' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Sat, 25 May 2013 22:47:15 -0700</pubDate>
    <lastBuildDate>Sat, 25 May 2013 22:47:15 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Help with DP algorithm</title>
      <link>http://www.programmersheaven.com/mb/Algorithms/421135/421135/help-with-dp-algorithm/</link>
      <description>Hi all,&lt;br /&gt;
&lt;br /&gt;
I am looking for some guidance on how to go about constructing (and coding) and algorithm that solves the following puzzle:&lt;br /&gt;
&lt;br /&gt;
There are 6 colors, randomly ascribed to the cells of an NxM grid.  The goal is, beginning with the color in the upper-left corner (let's call it 0,0), change the entire grid to one solid color in the smallest number of turns.  Adjacent cells with the same color become a blob, such that all connected cells of the same color as 0,0 will change.&lt;br /&gt;
&lt;br /&gt;
Thus, if we have N=3, M=3, and only 3 colors (for simplicity) - R (red), G (green), and B (blue), a random grid might look like this:&lt;br /&gt;
&lt;br /&gt;
R  B  R&lt;br /&gt;
G  G  B&lt;br /&gt;
R  B  G&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Changing 0,0 (which has value R) to G will result in:&lt;br /&gt;
&lt;br /&gt;
G  B  R&lt;br /&gt;
G  G  B&lt;br /&gt;
R  B  G&lt;br /&gt;
&lt;br /&gt;
Changing 0,0 (which now has value G) to B will result in:&lt;br /&gt;
&lt;br /&gt;
B  B  R&lt;br /&gt;
B  B  B&lt;br /&gt;
R  B  G&lt;br /&gt;
&lt;br /&gt;
Then to R:&lt;br /&gt;
&lt;br /&gt;
R  R  R&lt;br /&gt;
R  R  R&lt;br /&gt;
R  R  G&lt;br /&gt;
&lt;br /&gt;
And the last move, to G:&lt;br /&gt;
&lt;br /&gt;
G  G  G&lt;br /&gt;
G  G  G&lt;br /&gt;
G  G  G&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
My math skills are decent, but not graduate-level, and I am sure there is some existing complex algorithm out there that can be used.  I just have no idea what it is, and might need a nudge in the right direction on how to apply it.&lt;br /&gt;
&lt;br /&gt;
Can anyone lend a hand??&lt;br /&gt;
&lt;br /&gt;
Cheers,&lt;br /&gt;
&lt;br /&gt;
Chris&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/Algorithms/421135/421135/help-with-dp-algorithm/</guid>
      <pubDate>Fri, 21 Jan 2011 12:05:55 -0700</pubDate>
      <category>Algorithms</category>
    </item>
  </channel>
</rss>