or2( A, B, D);
System.out.println("The lowest common ancestor of 5 and 6 is " +res1.value);
System.out.println("The lowest common ancestor of 4 and 5 is " +res2.value);
System.out.println("The lowest common ancestor of 2 and 4 is " +res3.value);
}
结果:
The lowest common ancestor of 5 and6 is 1
The lowest common ancestor of 4 and5 is 2
The lowest common ancestor of 2 and 4 is 1