public class TestBSTDelete {
  public static void main(String[] args) {
    BST<String> tree = new BST<>();
    tree.insert("Grzegorz");
    tree.insert("Michał");
    tree.insert("Tomek");
    tree.insert("Adam");
    tree.insert("Jonasz");
    tree.insert("Piotr");
    tree.insert("Daniel");
    printTree(tree);

    System.out.println("\nPo usunięciu elementu Grzegorz:");
    tree.delete("Grzegorz");
    printTree(tree);

    System.out.println("\nPo usunięciu elementu Adam:");
    tree.delete("Adam");
    printTree(tree);

    System.out.println("\nPo usunięciu elementu Michał:");
    tree.delete("Michał");
    printTree(tree);
  }

  public static void printTree(BST<String> tree) {
    // Przechodzenie drzewa
    System.out.print("Inorder (posortowane): ");
    tree.inorder();
    System.out.print("\nPostorder: ");
    tree.postorder();
    System.out.print("\nPreorder: ");
    tree.preorder();
    System.out.print("\nLiczba węzłów: " + tree.getSize());
    System.out.println();
  }
}
