Suggest a algorihm for printing all paths from source to destination. | SoloLearn: Learn to code for FREE!

+1

Suggest a algorihm for printing all paths from source to destination.

c++

2/25/2018 5:50:40 AM

Naveen Kumar Maddineni

5 Answers

New Answer

+10

All paths possible or just an optimal path?

+9

A easy, direct solution is to use brute force search, which will look at every permutation, just be wary of the O(N!) complexity https://en.m.wikipedia.org/wiki/Brute-force_search

+1

Is this on a graph structure?

+1

all paths possible

+1

yes. on undirected graph