层次遍历二叉树

请读者对比学习本博客非递归先序遍历二叉树html

http://www.javashuo.com/article/p-cwfsocix-kq.html算法

func(Tree T){学习

if(T==NULL){
    printf("树空");
    return
}
Queue q;
EnQueue(q,T);
while(!IsEmpty(q)){
    DeQueue(q,T)
    visit(T);
    if(T->lchild)
        EnQueue(q,T->lchild);
    if(T->rchild)
        Enqueue(q,T->rchild);
}

}code


您可能感兴趣的
htm