File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -104,14 +104,14 @@ public class UsingNodeLevels {
104
104
105
105
System.out.println("The LCA of e and h which are in DIFFERENT LEVEL DIFFERENT TREES is: "+getLCA(e, h));
106
106
System.out.println("The LCA of c and h which are in SAME LEVEL DIFFERENT TREES is: "+getLCA(c, h));
107
- System.out.println("The LCA of d and c which are in DIFFERENT LEVEL SAME TREES is: "+getLCA(d, c).data );
108
- System.out.println("The LCA of f and e which are in SAME LEVEL SAME TREES is: "+getLCA(f, e).data );
107
+ System.out.println("The LCA of d and c which are in DIFFERENT LEVEL SAME TREES is: "+getLCA(d, c));
108
+ System.out.println("The LCA of f and e which are in SAME LEVEL SAME TREES is: "+getLCA(f, e));
109
109
110
110
}
111
111
112
112
113
113
114
- public static Node getLCA(Node a, Node b){
114
+ public static Character getLCA(Node a, Node b){
115
115
int level1 = getLevel(a);
116
116
int level2 = getLevel(b);
117
117
@@ -143,7 +143,7 @@ public class UsingNodeLevels {
143
143
return null;
144
144
145
145
// if a and b belong to same trees then either return a.data OR b.data
146
- return a; // OR return b.data;
146
+ return a.data ; // OR return b.data;
147
147
148
148
149
149
}
You can’t perform that action at this time.
0 commit comments