Status Assign(CSTree &T,TElemType e,TElemType value) 160
161 { //将树中值为e的结点改值为value。 162
CSTree p; 163
if(T) 164
{ 165
p=Point(T,e); 166
167 if(p) //p若有值,则证明存在且找到值为e的结点。 168
{ 169
p->data=value; 170
return OK; 171
} 172
} 173
174 return Nil; //不存在或树空。 175
} 176
177
TElemType Parent(CSTree T,TElemType e) 178
{ 179
CSTree p,t; 180
LinkQueue q; 181
InitQueue(q); 182
if(T) 183
{ 184
if(Value(T)==e) 185
186 return Nil; //根结点值为e,返回空。 187
EnQueue(q,T); 188
while(!QueueEmpty(q)) 189
190 {//遍历长子。 191
DeQueue(q,p); 192
193 if(p->firstchild) //有长子。 194
{ 195
if(p->firstchild->data==e) 196
return Value(p); 197
198 t=p; //双亲指针赋给t。 199
p=p->firstchild; 200
201 EnQueue(q,p); //长子指针入队。 202
while(p->nextsibling) 203