posted 18 years ago
I have an algorithm problem with recursion:
i have a route from A to D and it looks like this
the alphabet in the above list is an object of a class, lets call that class Nodes
each of this Nodes object they have some attributes... these are of type set..
the first set will store a bunch of other Nodes (these represent the current nodes neighbour)
the second set will store a bunch of tracks (Integer object representing what tracks the current nodes belong to)
(... bare with me here... )
so now i write up some code that initialise all the nodes... and here is the output...
and here is the code: (i removed the System.out... to shorten the code..)
what i want to do is to come up with some recursive algorithm so that it would print out something like this...
so i've come up with a pseudo code...
i've also come up with an actuall code but for some reason it'll only prints out the first step...
the code for this to follow...