Java Code
I can’t make this code work ,, help me please
private BinaryNode<String> remove(String x, BinaryNode<String> t) {
if (t == null)
return t;
int compareResult = x.compareTo(t.element);
if (compareResult < 0)
t.left = remove(x, t.left);
if (compareResult > 0)
t.right = remove(x, t.right);
else if (t.left != null && t.right != null) {
t.element = findMin(t.right).element;
t.right = remove(t.element, t.right);
}
else
t = (t.left != null) ? t.left : t.right;
return t;
}
i tried importing java util line
import java.util.*;
but don’t know how to make it run ,, keep marking BinaryNode as unknown