标题:求高手帮我解释一程序
取消只看楼主
xy2bl
Rank: 1
等 级:新手上路
帖 子:61
专家分:2
注 册:2010-12-2
结帖率:100%
已结贴  问题点数:10 回复次数:1 
求高手帮我解释一程序
void LevelOrder(BTNode *bt) /*层次遍历二叉树bt*/   
    { BTNode* queue[MAXSIZE];
      int front,rear;
      if (bt==NULL) return;
      front=0;      /*非循环队列*/
      rear=0;
      queue[rear++]=bt;
      while(front!=rear)
          {printf("%c",queue[front]->cdata);        /*访问队首结点的数据域*/
             if (queue[front]->lchild!=NULL)   /*将队首结点的左孩子指针入队列*/
             {  queue[rear]=queue[front]->lchild;rear++;
             }
            if (queue[front]->rchild!=NULL)   /*将队首结点的右孩子指针入队列*/
            {  queue[rear]=queue[front]->rchild; rear++;
         }
谁能帮我解释一下什么意思
尤其是这部分if (queue[front]->lchild!=NULL)   /*将队首结点的左孩子指针入队列*/
             {  queue[rear]=queue[front]->lchild;rear++;
             }
            if (queue[front]->rchild!=NULL)   /*将队首结点的右孩子指针入队列*/
            {  queue[rear]=queue[front]->rchild; rear++;
         }
搜索更多相关主题的帖子: 解释 
2010-12-03 13:16
xy2bl
Rank: 1
等 级:新手上路
帖 子:61
专家分:2
注 册:2010-12-2
得分:0 
谢谢
2010-12-05 12:02



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-327773-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.779851 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved