第一道题:
TElemType PreOrder(BiTree bt, int k)
/* bt is the root node of a binary linked list, */
/* Preorder travel it and find the node whose */
/* position number is k, and return its value. */
/* if can't found it, then return '#'. */
{
static int i;
i=k;
if(k<=0) return '#';
TElemType e;
if(bt)
{
if(i==1) e=bt->data;
else e='#';
if(bt->lchild&&e=='#') e=PreOrder(bt->lchild,i-1);
if(bt->rchild&&e=='#') e=PreOrder(bt->rchild,i-1);
return e;
}
return '#';
}
其实都挺简单的
多看看就懂了