BinarySearchTree need help please.

Hi, I just need some direction, im going to upload my assignment specifications (its short) and ask some questions about my implementation. im just having some trouble understanding some logic and im rusty on coding, just need someone to explain what im doing wrong i dont want a whole solution from yah. thanks in advance.




1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20

template <typename Comparable>
class BinarySearchTree{
        
        
    private:
        
        struct BinaryNode{
            Comparable element;
            BinarySearchTree<Comparable> *left;
            BinarySearchTree<Comparable> *right;
            
            BinaryNode(const Comparable & theElement, BinarySearchTree<Comparable> *leftTree, BinarySearchTree<Comparable> *rightTree) : element(theElement), left(leftTree), right(rightTree){}
        };
        
        BinaryNode *root;
        

};



this is the base class were given. to build a binary search tree(BST) in which every object in the tree is another tree. He made that condition to make it more dificult im assuming since i can find solution to a binary search tree of nodes all over but not one like this. the trees point to nodes and nodes point to trees. any advice on how to start this off? every time i start coding i realize how fucked my logic is and scrap it, i feel like im lost in a dark, scary forest lol.
I have no idea how to keep up with the tree given this condition. I cant copy the root tree because its untouchable right? its like instead of building a tree and having external nodes, every object of the tree is built inside the root tree, if my understanding of the way the implementation has to work is correct.
Topic archived. No new replies allowed.