6.41.txt

来自「数据结构实验 如下: Status Fibonacci(int k, int」· 文本 代码 · 共 29 行

TXT
29
字号
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 + =
减小字号Ctrl + -
显示快捷键?