max=depth; 116
} 117
return max+1; 118
} 119
120
TElemType Value(CSTree p) 121
122 { //返回结点p所指的值。 123
return p->data; 124
} 125
126
TElemType Root(CSTree T) 127
128 { //返回T的根。 129
if(T) 130
return Value(T); 131
else 132
return Nil; 133
} 134
135
CSTree Point(CSTree T,TElemType s) 136
137 { //返回树T中指向值为s的结点的指针。 138
LinkQueue q; 139
QElemType a; 140
if(T) 141
{ 142
InitQueue(q); 143
EnQueue(q,T); 144
while(!QueueEmpty(q)) 145
146 { //先后将所有结点入队,查找是否有值为s的结点。 147
DeQueue(q,a); 148
if(a->data==s) 149
return a; 150
if(a->firstchild) 151
EnQueue(q,a->firstchild); 152
if(a->nextsibling) 153
EnQueue(q,a->nextsibling); 154
} 155
} 156
return NULL; 157
} 158
159
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说教育文库资料-树的孩子兄弟表示法及相关操作(8)在线全文阅读。
相关推荐: