主题:什么错误?help!
求某个结点的前序遍历序号:
我这样写貌似有点问题:
template <class T>
int BinaryNode <T>::PreOrderNum (const BinaryNode <T>* key,int &num){
if(key==this) return num;
num++;
if(left!=0)left->PreOrderNum(key,num);
if(right!=0)right->PreOrderNum(key,num);
}
我这样写貌似有点问题:
template <class T>
int BinaryNode <T>::PreOrderNum (const BinaryNode <T>* key,int &num){
if(key==this) return num;
num++;
if(left!=0)left->PreOrderNum(key,num);
if(right!=0)right->PreOrderNum(key,num);
}