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 99 * Wikipedia Reference: https://en.wikipedia.org/wiki/Tree_(graph_theory)
1010 * Author: Aman
1111 */
12-
13-
1412class GraphTreeCheck {
1513
1614 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 ];
1917 private int nodes ;
2018
2119 public static void main (String [] args ) {
@@ -40,6 +38,8 @@ public static void main(String[] args) {
4038 } else {
4139 System .out .println ("The graph is NOT a tree." );
4240 }
41+
42+ in .close ();
4343 }
4444
4545 public boolean isTree () {
@@ -73,6 +73,7 @@ private boolean hasCycle(int current, int parent) {
7373 }
7474 }
7575 }
76+
7677 return false ;
7778 }
7879}
You can’t perform that action at this time.
0 commit comments