I am having trouble finding the smallest element of a binary search tree. I have some code finished, but it is not working.
public T getMinElement(TreeNode<T> node) {
//TODO: implement this
if (node == null){
return null;
}
if (node.getLeftChild() == null){
return (T) node;
}
else{
return getMinElement(node);
}
}