It's been a year since I've coded so I apologize for being a noob. Anyways I'm implementing a Binary Search Tree class and I understand the concepts but my coding practice is rusty.
below is my code, the class, excluding the public functions is the basis for which I am to build my tree. Each node in the tree is supposed to be "by definition, the root of a binary search tree".
when i declare an object of it in main i get errors if i try to apply parameters like so:
BinarySearchTree<int> *t(6);
but without the parentheses and input it will build a normal no argument binaryTree, just wondering if someone can point out the problem i cant remember how to do this... would i have to make a function to set the value of its element? im hoping there is a simpler way.
the biggest problem is for me, that we have to initialize each one as a binaryysearchtree and the node is a private data member. So to access its values and such ill have to make a function that returns its stored value and from main access it via the function call?
the only way i can make it work logically in my head is that the first object created is the root, unless of course i made another BinaryNode data member in the class, say "BinaryNode *TheRoot;"
and use TheRoot for the first object created and use root for each other object, since they all have to be "the root of a binarySearchTree by definition", any advice?