P169 T12
作者:互联网
//注:BiTree为指针类型 BiTree find(BiTree T, int k) { if(k < 1 || k > T.count) return NULL; if(T->lchild) { if(T->lchild->count + 2 == k) return T; else if(T->lchild->count + 2 > k) return find(T->lchild, k); else if(T->rchild) return find(T->rchild, k - (T->lchild->count + 2)); else return NULL; } else { if(k == 1) return T; else if(T->rchild) return find(T->rchild, k - 1); else return NULL; } }
标签:lchild,count,P169,return,else,T12,rchild,find 来源: https://www.cnblogs.com/WTSRUVF/p/11207242.html