📄 6.41.txt
字号:
int c = 0;
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 '#'. */
{
TElemType ans = '#';
if(bt){
c++;
if(c > k){
c = 0;
return '#';
}
if(c == k){
c = 0;
return bt->data;
}
else {
ans = PreOrder(bt->lchild, k);
if(ans != '#') return ans;
ans = PreOrder(bt->rchild, k);
if(ans != '#') return ans;
}
}
return ans;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -