# A valid path from A to J - Question 2

Posted by Naimishforu under Interview Questions on 2/10/2011 | Points: 10 | Views : 1534 | Status : [Member] [MVP] | Replies : 4
Hi,

This is Part 2

Recently I had been interviewed internationally!!!!! It would be very much helpful if you can also try to solve this "things".

Please first examine the below image:

Figure 1 shows a set of nodes that are labeled from A to J. The position of each node can be defined by the x, y coordinate system. The dotted segments joining the nodes A, B, E, F, I and J, shows a possible path from A to J through the nodes B, E, F and I.

2. A valid path from A to J is a path which passes through at least two nodes or is made up of at least three segments. Considering the fact that you can only move further to the right when traversing the nodes, that is, x-coordinate of the current node must always be greater than the x-coordinate of the previous node, using the classes that you have defined, write an algorithm which will list all the possible valid paths from A to J in an array.

Thanks

#### Responses

Posted by: jayanthichebrolupanoramicworldbiz-8895 on: 2/11/2011 [Member] Starter | Points: 25