Advertisement
Neveles

Untitled

Mar 15th, 2020
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 KB | None | 0 0
  1.     // создание пустого дерева
  2.     BinarySearchTree <int> iterativeTree;
  3.  
  4.     iterativeTree.iterativeInsert(10);
  5.     iterativeTree.iterativeInsert(3);
  6.     iterativeTree.iterativeInsert(20);
  7.     iterativeTree.iterativeInsert(15);
  8.     iterativeTree.iterativeInsert(30);
  9.     iterativeTree.iterativeInsert(2);
  10.     iterativeTree.iterativeInsert(5);
  11.     iterativeTree.iterativeInsert(32);
  12.     iterativeTree.iterativeInsert(22);
  13.  
  14.     // Вывод узлов дерева в выходной поток
  15.     iterativeTree.print(cout);
  16.     cout << "\n";
  17.  
  18.     BinarySearchTree <int> recursiveTree;
  19.  
  20.     recursiveTree.recursiveInsert(10);
  21.     recursiveTree.recursiveInsert(3);
  22.     recursiveTree.recursiveInsert(20);
  23.     recursiveTree.recursiveInsert(15);
  24.     recursiveTree.recursiveInsert(30);
  25.     recursiveTree.recursiveInsert(2);
  26.     recursiveTree.recursiveInsert(5);
  27.     recursiveTree.recursiveInsert(32);
  28.     recursiveTree.recursiveInsert(22);
  29.  
  30.     recursiveTree.print(cout);
  31.     cout << "\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement