#include #include "AVLTree.h" using namespace std; template void printTree(AVLTree &tree) { // Traverse tree cout << "\nInorder (sorted): " << endl; tree.inorder(); cout << "\nPostorder: " << endl; tree.postorder(); cout << "\nPreorder: " << endl; tree.preorder(); cout << "\nThe number of nodes is " << tree.getSize(); cout << endl; } int main() { // Create an AVL tree int numbers[] = {25, 20, 5}; AVLTree tree(numbers, 3); cout << "After inserting 25, 20, 5:" << endl; printTree(tree); tree.insert(34); tree.insert(50); cout << "\nAfter inserting 34, 50:" << endl; printTree(tree); tree.insert(30); cout << "\nAfter inserting 30" << endl; printTree(tree); tree.insert(10); cout << "\nAfter inserting 10" << endl; printTree(tree); tree.remove(34); tree.remove(30); tree.remove(50); cout << "\nAfter removing 34, 30, 50:" << endl; printTree(tree); tree.remove(5); cout << "\nAfter removing 5:" << endl; printTree(tree); return 0; }