摘要
二叉树的遍历就是对二叉树中的每一个结点访问一次,且仅访问一次。本文介绍二叉树的层次遍历算法是利用队列的队头、队尾指针及树节点的左、右指针;从根节点开始,队头指针对应的左、右指针中不空者依次入队,队尾指针加1:其后,队头指针加1,并删除原队头指针:取出当前的队头指针,重复前面的步骤,直至队空为止。
The floor traversing of the binary tree means visiting the binary tree according to the floors. The visiting process means that making use of the queue stores the pointer of the node by the way of the floors. After the left-right pointer of every node is stored. The node of the queue-head pointer is visited. Then, the left-right pointer of the recent queue-head is stored after canceling the pointer of the queue-head. The floor traversing of the binary tree is completed throng repeatedly executing the procedure in the way. In the end the floor traversing algorithm of the binary is gotten.
出处
《铜仁师范高等专科学校学报》
2004年第4期39-41,共3页
Journal of Tongren Teachers College