I am currently working on a program to implement a binary search tree. The struct for the tree is as follows:
struct treeNode {
Type value;
int count;
treeNode* left;
treeNode* right;
};
treeNode* root;
I am trying to implement the following function:
template <class Type>
int bstree<Type>::count(){
return count(root);
}
template <class Type>
int bstree<Type>::count(treeNode* sroot){
}
I am trying to figure out how I would visit every node and add up all the count values for each node.