摘要: 定义和初始化#include#include#inlcude初始化:C c;空容器,如vector ivec;C c(c2);创建容器c2的副本cC c(b,e);由迭代器b,e标识的范围内的元素的副本,如list ilist(ivec.begin(),ivec.end());C c(n,t);用n... 阅读全文
posted @ 2014-11-24 15:48 yyxayz 阅读(281) 评论(0) 推荐(0) 编辑
摘要: 方法一:递归 1 void printNLevel(TreeNode *root, int n) 2 { 3 if (root == NULL) 4 { 5 return ; 6 } 7 8 if (n == 1) 9 {10 ... 阅读全文
posted @ 2014-11-24 15:23 yyxayz 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 二叉树的层次遍历,也就是广度优先遍历。代码如下: 1 void HierarchyBiTree(BiTree *Root) 2 { 3 LinkQueue *Q; 4 5 InitQueue(Q); 6 7 if (Root == NULL) return ; 8 ... 阅读全文
posted @ 2014-11-24 15:11 yyxayz 阅读(157) 评论(0) 推荐(0) 编辑