• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Need help figuring an algorithm to this. Hardest algorithm?

 
Ranch Hand
Posts: 74
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 23951
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 1205
22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
F is for finger. Can you stick your finger in your nose? Doesn't that feel nice? Now try this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic