File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
src/main/java/com/thealgorithms/tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 9
9
* Wikipedia Reference: https://en.wikipedia.org/wiki/Tree_(graph_theory)
10
10
* Author: Aman
11
11
*/
12
-
13
-
14
12
class GraphTreeCheck {
15
13
16
14
private static final int MAX = 10 ;
17
- private int [][] adjMatrix = new int [MAX ][MAX ];
18
- private boolean [] visited = new boolean [MAX ];
15
+ private final int [][] adjMatrix = new int [MAX ][MAX ];
16
+ private final boolean [] visited = new boolean [MAX ];
19
17
private int nodes ;
20
18
21
19
public static void main (String [] args ) {
@@ -40,6 +38,8 @@ public static void main(String[] args) {
40
38
} else {
41
39
System .out .println ("The graph is NOT a tree." );
42
40
}
41
+
42
+ in .close ();
43
43
}
44
44
45
45
public boolean isTree () {
@@ -73,6 +73,7 @@ private boolean hasCycle(int current, int parent) {
73
73
}
74
74
}
75
75
}
76
+
76
77
return false ;
77
78
}
78
79
}
You can’t perform that action at this time.
0 commit comments