Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. // CSE 330 Lab 6.cpp : This file contains the 'main' function. Program execution begins and ends there.
  2. //
  3.  
  4. #include "pch.h"
  5. #include <iostream>
  6. #include "BinarySearchTree.h"
  7.  
  8. int main()
  9. {
  10. BinarySearchTree<int> bt1 = BinarySearchTree<int>();
  11. bt1.insert(6);
  12. bt1.insert(2);
  13. bt1.insert(8);
  14. bt1.insert(1);
  15. bt1.insert(4);
  16. bt1.insert(3);
  17. bt1.printTreePostOrder();
  18. cout << endl;
  19. bt1.printTreePreOrder();
  20. cout << endl;
  21. cout << bt1.isBalanced() << endl;
  22. cout << bt1.height() << endl;
  23.  
  24. BinarySearchTree<int> bt2 = BinarySearchTree<int>();
  25. bt2.insert(6);
  26. bt2.insert(4);
  27. bt2.insert(2);
  28. bt2.insert(5);
  29. bt2.insert(7);
  30. bt2.insert(8);
  31. bt2.insert(9);
  32. bt2.printTreePostOrder();
  33. cout << endl;
  34. bt2.printTreePreOrder();
  35. cout << endl;
  36. cout << bt2.isBalanced() << endl;
  37. cout << bt2.height() << endl;
  38.  
  39. BinarySearchTree<int> bt3 = BinarySearchTree<int>();
  40. bt3.insert(7);
  41. bt3.insert(5);
  42. bt3.insert(2);
  43. bt3.insert(6);
  44. bt3.insert(10);
  45. bt3.insert(8);
  46. bt3.insert(12);
  47. bt3.printTreePostOrder();
  48. cout << endl;
  49. bt3.printTreePreOrder();
  50. cout << endl;
  51. cout << bt3.isBalanced() << endl;
  52. cout << bt3.height() << endl;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement