int main(){ AVLTree rbt; vector<int> values = { 10, 5, 2, 1, 3, 7, 15, 25, 30 }; for (auto v : values) { rbt.add(v); } values = { 45, 36, 67, 90, 04, 23, 52, 11 }; for (auto v : values){ rbt.add(v); rbt.print(); cin.ignore(1); } return 0; }
int main() { AVLTree<char> Tree; std::string input("ABCDEF"), str; for( auto x: input ) Tree.add(x); // std::function<void(const char& )> visit = // []( const char& x) // { std::cout << x << ' '; } ; // Tree.display (visit ) ; std::function<void(const char& )> visit1 = [&str]( const char& x) { str+=x; } ; Tree.display ( visit1 ) ; assert( str == "DBEACF" ); assert( Tree.count() == input.length() ); assert( Tree.contains('E') == true ); assert( Tree.contains('X') == false ); return 0; }