
public class BSTProg {
    
   
 public static void main(String[] args)
  {
    String[] words = {"One", "Two", "Three", "Four", "Five",
                      "Six", "Seven", "Eight", "Nine", "Ten"};
    MyTreeSet bst = new MyTreeSet();

    for (String word : words)
    {
      System.out.println("Added: " + word + " " + bst.add(word));
      System.out.println("Contains: " + word + " " + bst.contains(word));
      if(bst.add(word))
        System.out.println("*** Added a duplicate value ***");
      System.out.println(bst);
    }

    System.out.println("Traversal with an iterator:");
    for (Object obj : bst)
      System.out.print(obj + " ");
    System.out.println();

    for (String word : words)
    {
      System.out.println("Removed: " +  word + " " + bst.remove(word));
      if(bst.remove(word))
        System.out.println("*** Removed a non-existent value ***");
      System.out.println(bst);
    }
  }
    }


