//
// Created by Dmytrii Ivanov on 07/02/2021.
//

#ifndef PR5_1_BINTREE_H
#define PR5_1_BINTREE_H


class BinTree {
public:
    struct Node {
        char value;
        unsigned int count;
        Node *pre; // Zeiger auf Vorgaenger (optional)
        Node *left;
        Node *right;

        explicit Node(char ch, Node *t = nullptr);
    };

    BinTree();
    ~BinTree();

    int size() const;
//    Node* findValue( const char& val) const;
    char find( const char val, Node* leaf ) const;
    Node* insert(const char &val, Node* n );
    Node* getRoot() const;
    unsigned int countNode(Node* n) const;
    void inOrder(Node* n);
    void levelOder(Node* n);
    void nodeInsert(const char &val);
    Node* rotateLeft(Node* n);
    Node* rotateRight(Node* n);
    Node* insertRoot(const char );


private:
    Node* root; // die Wurzel
    int sz; // Anzahl der Knoten
};


#endif //PR5_1_BINTREE_H