Advertisement
Sanlover

Untitled

Dec 2nd, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #ifndef MYTREE_TREE_H
  2. #define MYTREE_TREE_H
  3.  
  4. struct Node
  5. {
  6. Node* right = nullptr;
  7. Node* left = nullptr;
  8. int value;
  9. };
  10.  
  11. #include <iostream>
  12.  
  13. class Tree
  14. {
  15. private:
  16. Node* head;
  17.  
  18. void preOrder(Node* node);
  19. void inOrder(Node* node);
  20. void postOrder(Node* node);
  21.  
  22. void addMethod(Node*& node, const int& value);
  23. void deleteMethod(Node* node);
  24.  
  25. void eraseMethod(const int& value);
  26. int heightMethod(Node* node);
  27. void func();
  28.  
  29. public:
  30. Tree();
  31. ~Tree()
  32. {
  33. deleteMethod(head);
  34. };
  35.  
  36. bool empty();
  37. void clear();
  38.  
  39. int height();
  40. void add(const int& value);
  41.  
  42. void print(const size_t& sortId);
  43. };
  44.  
  45. #endif
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement