Cookie Notice

As far as I know, and as far as I remember, nothing in this page does anything with Cookies.

2011/02/25

Capital Idea 3 - Going 'Round In Circles

I thought I had an idea to solve the state capital issue.

  • Go through each line in the list in order of length
  • If both points of the line are not handled twice ( connected on either side ), place it into the path
  • Quit when every point (state capital) is hit twice
This gives you all the points, but it does not give you an order.
  • pull line out of path
  • for each line in the path 
    • check if one of the points
    • if one of the points is the one we want, throw it into the output array
    •  else put it into the dummy path array
  • push line into path
There is a problem, however.

Nothing I have done guarantees that all the states are connected. And in this case, I know that the states are not all connected.

Back to the drawing board.

No comments:

Post a Comment