随笔分类 - 图论——树
摘要:#include<iostream> #include<string.h> using namespace std; #define maxn 100 int ver[maxn],head[maxn],nxt[maxn],size[maxn],len[maxn]; int n,m; int vis[
阅读全文
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1710 通过先序以及中序遍历建树并且输出后序遍历的结果。 代码如下: #include<bits/stdc++.h> using namespace std; typedef unsigned int u
阅读全文
摘要:以下代码中显示了二叉树的链式存储以及先序遍历递归建树,后序遍历释放资源,复制一棵二叉树,先序、中序、后序遍历的递归以及非递归实现,求叶子结点数量的递归以及非递归函数,求非叶子结点的递归以及非递归函数。求深度的递归函数。 文件输入,文件中的内容是 1 2 4 0 0 5 6 0 0 0 3 7 0 0
阅读全文

浙公网安备 33010602011771号