int main() { BST test; int n; cin >> n; for (int i=0; i<n; i++) { int x; cin >> x; test.add(x); } cout << test.getmin(); cout << test.getmax(); cout << test.height(); test.prevorder(); test.inorder(); test.postorder(); int x; cin >> x; test.del(x); //test.inorder(); cout << test.size() << endl; for (int i=0; i<3; i++) { cin >> x; cout << test.rank(x) << endl; } }
int main() { srand((unsigned)time(NULL)); const int size = 1000000; int* arr = new int[size]; for(int i = 0; i < size; i++) arr[i] = rand() % 1000000 + 1; BST<int>* ex = new BST<int>(arr, size); //ex->dump(); cout << ex->search(2) << endl; cout << ex->search(5) << endl; ex->del(7); //ex->dump(); delete arr; delete ex; return 0; }