Advertisement
Guest User

Untitled

a guest
Jan 28th, 2020
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.32 KB | None | 0 0
  1. #pragma region Node Structure
  2. struct Node
  3. {
  4.     int info;
  5.     Node* left;
  6.     Node* right;
  7.     Node() : info(0), left(nullptr), right(nullptr) {};
  8.     Node(int _info) : info(_info), left(nullptr), right(nullptr) {};
  9. };
  10. #pragma endregion
  11.  
  12. #pragma region BT
  13. class BT
  14. {
  15. public:
  16.     BT();
  17.     void PreOrderR();
  18.     void PreOrder();
  19.     void InOrder();
  20.     void PostOrder();
  21.     int GetNumberNodes();
  22.     int GetNumberNodesR();
  23.     int Height();
  24.     ~BT();
  25.  
  26. private:
  27.     Node* root;
  28.     int GetNumberNodesR(Node* n
  29. );
  30.     void PreOrderR(Node* n);
  31.     void InOrder(Node* n);
  32.     void PostOrder(Node* n);
  33.     int Height(Node* n);
  34.     void DestroyTree(Node* n);
  35. };
  36. #pragma endregion
  37.  
  38. #pragma region BST
  39. class BST
  40. {
  41. public:
  42.     BST();
  43.     Node* Search(int _key);
  44.     Node* SearchR(int _key, Node* _n);
  45.     void Insert(int _key);
  46.     void InsertR(int _key, Node* _n);
  47.     bool Exist(int _key);
  48.     bool ExistR(int _key, Node* _n);
  49.     ~BST();
  50.  
  51. private:
  52.     Node* root;
  53. };
  54. #pragma endregion
  55.  
  56. #pragma region Graph
  57. typedef int vertex;
  58. typedef std::pair<int, int> edge;
  59.  
  60. class Graph
  61. {
  62.     std::map<int, std::vector<int>> g;
  63. public:
  64.     Graph();
  65.     Graph(Graph* _gExtern);
  66.     Graph(std::vector<edge> _el);
  67.     void Insert(edge);
  68.     void Remove(edge);
  69.     bool Path(vertex _initial, vertex _final);
  70.     void Print();
  71.     bool isEulerian();
  72.     int Index(vertex _e);
  73.     ~Graph();
  74.  
  75. private:
  76.  
  77. };
  78. #pragma endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement