摘要: 题目:输入一颗二元树,从上往下按层打印树的每个结点,同一层中按照从左往右的顺序打印。 例如输入 8 / \ 6 10 /\ /\ 5 7 9 11 输出8 6 10 5 7 9 11。思路:广度优先遍历#include <iostream>#include <deque>using namespace std;struct BTree{ BTree* pLeft; BTree* pRight; int value;};void InsertBTree(BTree* &pRoot, int val){ if (!pRoot) { pRoot=new B... 阅读全文
posted @ 2013-01-03 14:48 lscheng 阅读(765) 评论(0) 推荐(0) 编辑