public static <T> BinaryTree<T> LCA(BinaryTree<T> i, BinaryTree<T> j) {
        int depth_i = get_depth(i), depth_j = get_depth(j);
        if(depth_j > depth_i) {
            BinaryTree<T> temp = i;
            i = j;
            j = temp;
        }

        // Advance deeper node first.
        int depth_diff = Math.abs(depth_i - depth_j);
        while(depth_diff-- > 0) {
            i = i.getParent();
        }

        // Both pointers advance until they found a common ancestor.
        while(i != j) {
            i = i.getParent();
            j =j.getParent();
        }
        return i;
    }