在一个广度优先的二叉树中,节点在一个规定的顺序下被访问。首先根节点的深度是0,接下来是,按从左到右的顺序。你能用一个queue去实现一个广度优先的二叉树。
Algorithm for Breadth- First Traversal of a Binary Tree
1. Insert the root node in the queue.
2.while the queue is not empty
3.Remove a node from the queue and visit it.
4.Place references to its left and right subtrees in the
queue.
You can use the queue class from the standard library.
这个程序需要在BinaryTree1.txt BinaryTee2.txt 中测试。你需要用到的文件在以下链接中会得到。
文件夹名字请用 yourname_BFS_FP.tar
可能的话请尽量在LINUX下编写,尽量不要用VC来写
多谢了先
下载地址是 rayfile /zh-cn/files/abe8045e-9d76-11df-bd6e-0015c55db73d/
请自行补全网址,多谢了先
3号能回到上来再加100分