首页 > 技术文章 > 层次遍历二叉树

Coeus-P 2018-07-23 10:19 原文

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

https://www.cnblogs.com/Coeus-P/p/9353186.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);
}

}

您可能感兴趣的

推荐阅读