Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 11 Online
OpenStudy (anonymous):

PS 11. Does anybody solved the PS such as it passes all the tests? Example: A->B 10 A->C 3 C->B 3 B->D 1 B->D 6 Looking for path from A to D. Optimal: A->C->B->D with weight 7 If B was visited before C (B is in "visited" list) we will get A->C->D with weight 9 that is not optimal solution. How do you fix it? I've set up the algorithm to remember passed edges instead of vertexes, but it runs times times longer.

OpenStudy (anonymous):

Found a fixture: don't add all visited vertices to "visited" list. Add only the root node, that is a start node for the next recursion cycle. Thereby visited list will contain only vertices that are visited in current path.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
3 days ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
3 days ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!