Try using a visited flag for all the nodes. Initialise it to zero and toggle it when you traverse through it,.Based on status of visited flag, you can avoid visiting the visited nodes.
Regards, Vineel. -- You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-code?hl=en.
