Advertisement
Guest User

Untitled

a guest
Dec 15th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "binary_tree.h"
  2. #include <iostream>
  3. #include <vector>
  4. #include <ostream>
  5. #include <cmath>
  6.  
  7. /*
  8.  * transplant
  9.  * find place to add
  10.  */
  11.  
  12. class MyClass{
  13. public:
  14.     int value;
  15.     MyClass(){
  16.         value = 0;
  17.     }
  18.     MyClass(const int& new_value){
  19.         value = new_value;
  20.     }
  21.  
  22.     bool operator<(MyClass& arg) const{
  23.         return value < arg.value;
  24.     }
  25. };
  26.  
  27.  
  28. int main()
  29. {
  30.     BinaryTree<MyClass> tree;
  31.     tree.push(MyClass(3));
  32.     tree.push(MyClass(4));
  33.     tree.push(MyClass(2));
  34.     const MyClass min  = tree.min();
  35.     std::cout << min.value << std::endl;
  36.  
  37.     return 0;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement