按层次遍历树中结点



void LayerOrderTraverse(BiNode* T)
{
Queue
<Node *> q;
if(NULL == T)
return;
q.push(T);
while(!q.isEmpty())
{
T
= q.pop();
printf(
"%d ",T->data);
if(T->lchild)
q.push(T
->lchild);
if(T->rchild)
q.push(T
->rchild);
}
}

相关文章:

  • 2021-06-26
  • 2021-08-26
  • 2021-04-22
猜你喜欢
  • 2021-07-26
  • 2021-05-26
  • 2021-10-11
相关资源
相似解决方案