We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a653810 commit e04f145Copy full SHA for e04f145
src/main/java/com/thealgorithms/backtracking/All_Paths_From_Source_To_Target.java
@@ -53,7 +53,7 @@ public void addEdge(int u, int v)
53
54
// Prints all paths from 's' to 'd'
55
56
- public void printAllPaths(int s, int d, int c)
+ public void printAllPaths(int s, int d)
57
{
58
boolean[] isVisited = new boolean[v];
59
ArrayList<Integer> pathList = new ArrayList<>();
@@ -62,7 +62,7 @@ public void printAllPaths(int s, int d, int c)
62
pathList.add(s);
63
64
// Call recursive utility
65
- printAllPathsUtil(s, d, isVisited, pathList);
+ printAllPathsUtil(s, d, isVisited, pathList,a);
66
return a[0];
67
}
68
@@ -88,7 +88,7 @@ private int printAllPathsUtil(Integer u, Integer d, boolean[] isVisited, List<In
88
if (!isVisited[i]) {
89
// store current node in path[]
90
localPathList.add(i);
91
- printAllPathsUtil(i, d, isVisited, localPathList);
+ printAllPathsUtil(i, d, isVisited, localPathList,a);
92
93
// remove current node in path[]
94
localPathList.remove(i);
0 commit comments