/** * Binary tree class header * CS 2240 * University of Vermont * Clayton Cafiero * 2020-Jun-20 */ #ifndef TREE_H #define TREE_H #include #include /** * Node class. Tree will consist of nodes */ class Node { private: std::string label; Node *left_child; // pointer to a Node Node *right_child; // pointer to a Node public: // Constructor Node(std::string label); // Accessors std::string getLabel() const; Node* getRightChild() const; // returns pointer to Node Node* getLeftChild() const; // returns pointer to Node void setRightChild(Node *ptr); void setLeftChild(Node *ptr); }; /** * BinaryTree class. To contain a collection of nodes. */ class BinaryTree { private: Node* root; public: BinaryTree(Node *root); // Constructor ~BinaryTree(); // Destructor void destroy(Node *n); // Search functions std::vector preorder(); std::vector postorder(); std::vector inorder(); std::vector bfs(); }; #endif // TREE_H