⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 6.41.txt

📁 数据结构实验 如下: Status Fibonacci(int k, int m, int &f) /* 求k阶斐波那契序列的第m项的值f */
💻 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 + -