Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Need help figuring an algorithm to this. Hardest algorithm?

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Guys, I have a problem and needs to determine an algorithm using java. The problem is this image:


Santa Claus needs to go to all of the places marked in red. He starts in the topmost level (Santa Claus Village)
And he needs to go to places marked in circles chronologically (or not chronologically) from left to right.
For example, to go to California, he must go to North America then to Us then to California.
After going to california, he must go to LA by going back to US then travel to Texas then LA.
He must go to Virginia by going back to Texas to US then Virginia
Then he must go to Hidalgo by going back to US then North America >Mexico>Hidalgo
Then go to Germany by back to Mexico> North America > Santa Claus Village > Europe > Germany and so on...


The hardest part is that there is no finite number of loop inside NA, Europe and Asia
Please advice me people. I'm having hard time solving this problem. Please please please
 
author
Posts: 23840
141
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Matt Taylor wrote:
The hardest part is that there is no finite number of loop inside NA, Europe and Asia
Please advice me people. I'm having hard time solving this problem. Please please please



Looks like it can be solved by a standard depth first search algorithm -- which of course, is one of the earlier algorithms taught under the banner of recursion. Perhaps you should look into "recursion" techniques?

Henry
 
Rancher
Posts: 1180
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Of course we're not going to do your homework for you. However, if you're stuck at any particular point we're more than happy to help. DoYourOwnHomework
 
And tomorrow is the circus! We can go to the circus! I love the circus! We can take this tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!