Hi All,
I'm trying to make a routine that returns node number XX from a BST.
The nodes are as follows:
struct Node
{
signed int type;
Node* child1;
Node* child2;
};
I can easily count the number of nodes by
long Pheno::CountNodes(Node* n)
{
if(n==NULL)
return 0;
return(Pheno::CountNodes(n->child1)+1+Pheno::CountNodes(n->child2));
}
But I can't figure out how to count myself to node # XX and return it.?? Doesn't matter if it is depth or breath first.
Hope someone out there can help.
Thanks,
- hmortensen