public class TestBST {
public static void main(String[] args) {
BST<String> tree = new BST<>();
tree.insert("Green");
tree.insert("Mabel");
tree.insert("Teal");
tree.insert("Blue");
tree.insert("Jade");
tree.insert("Purple");
tree.insert("Danube");
System.out.print("Inorder (sorted): ");
tree.inorder();
System.out.print("\nPostorder: ");
tree.postorder();
System.out.print("\nPreorder: ");
tree.preorder();
System.out.print("\nThe number of nodes is " + tree.getSize());
System.out.print("\nIs Purple in the tree? " +
tree.search("Purple"));
System.out.print("\nA path from the root to Purple is: ");
java.util.ArrayList<BST.TreeNode<String>> path
= tree.path("Purple");
for (int i = 0; path != null && i < path.size(); i++)
System.out.print(path.get(i).element + " ");
Integer[] numbers = {2, 4, 3, 1, 8, 5, 6, 7};
BST<Integer> intTree = new BST<>(numbers);
System.out.print("\nInorder (sorted): ");
intTree.inorder();
}
}