Skip to content

Commit 320025a

Browse files
committed
Update FindLCAInTreeForestUsingLevels
1 parent 54038fe commit 320025a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

FindLCAInTreeForestUsingLevels

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ public class UsingNodeLevels {
104104

105105
System.out.println("The LCA of e and h which are in DIFFERENT LEVEL DIFFERENT TREES is: "+getLCA(e, h));
106106
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));
109109

110110
}
111111

112112

113113

114-
public static Node getLCA(Node a, Node b){
114+
public static Character getLCA(Node a, Node b){
115115
int level1 = getLevel(a);
116116
int level2 = getLevel(b);
117117

@@ -143,7 +143,7 @@ public class UsingNodeLevels {
143143
return null;
144144

145145
// 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;
147147

148148

149149
}

0 commit comments

Comments
 (0)