int main() { RedBlackTree<int, int> tree; /*for(int i = 0; i<10; i++) { std::pair<int, int> item; item.first = i; item.second = i; tree.insert(item); }*/ std::pair<int, int> item; item.first = 0; item.second = 0; tree.insert(item); tree.print(); item.first = 1; item.second = 1; tree.insert(item); tree.print(); item.first = 2; item.second = 2; tree.insert(item); tree.print(); item.first = 3; item.second = 2; tree.insert(item); tree.print(); item.first = 4; item.second = 2; tree.insert(item); tree.print(); item.first = 6; item.second = 2; tree.insert(item); tree.print(); item.first = 1; item.second = 2; tree.insert(item); tree.print(); for(BinarySearchTree<int, int>::iterator it = tree.begin(); it != tree.end(); ++it) { std::cout << it->first << " "; } return 0; }
int main(int argc, char const *argv[]) { RedBlackTree<int, string> sample; sample.insert(make_pair(10,"haha")); sample.insert(make_pair(20,"haha")); sample.insert(make_pair(30,"haha")); sample.insert(make_pair(15,"haha")); sample.insert(make_pair(25,"haha")); sample.insert(make_pair(12,"haha")); sample.insert(make_pair(5,"haha")); sample.insert(make_pair(3,"haha")); sample.insert(make_pair(8,"haha")); sample.insert(make_pair(27,"haha")); sample.insert(make_pair(40,"haha")); sample.insert(make_pair(50,"haha")); sample.insert(make_pair(45,"haha")); sample.insert(make_pair(9,"haha")); sample.print(); return 0; }