/**
*
* EmptyBinaryTree – the is the empty tree. Note it has no fields so all empty trees are the same.
* Note I have added a static factory method that just return the same object.
* This saves on creating many objects which are all just the same.
*
*/
package Lab3_Trees.task1;
public class EmptyBinaryTree
public int size() {
return 0;
}
public BinaryTree
return new NonEmptyBinaryTree
}
@Override
public int height() {
return -1;
}
@Override
public String preOrderShow() {
return “”;
}
@Override
public BinaryTree
return this;
}
@Override
public boolean isEmpty() {
return true;
}
@Override
public T biggest() {
return null;
}
@Override
public String treeshow() {
return ” “;
}
@Override
public boolean find(T d) {
return false;
}
@Override
public T smallest() {
return null;
}
}