![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
二叉树
Jerry Lee の blog
never never never give up.
展开
-
树的一些操作,杂记
树的一些操作,杂记 //新建结点数据类型 typedef struct{ typename data; node* lchild; node* rchild;}Node; //新建树结点 Node* new_node(int v) { Node* node=new Node; node->data=v; node->lchild=node->rchild原创 2017-11-16 21:01:24 · 193 阅读 · 0 评论 -
二叉树遍历
二叉树遍历习题题意:给出一个二叉树的后序遍历序列和中序遍历序列,求这颗二叉树的层序遍历序列。 输入7 2 3 1 5 7 6 4 1 2 3 4 5 6 7 输出4 1 6 3 5 7 2 #include <iostream> #include <cstring> #include <queue> #include <algorithm>using namespace std; const int原创 2017-11-16 21:14:00 · 226 阅读 · 0 评论 -
后序、中序得前序、层序
后序、中序得前序、层序输入7 2 3 1 5 7 6 4 1 2 3 4 5 6 7 输出4 1 6 3 5 7 2 两种方法:1.第一种编程较为复杂,但是思路清晰,而且通用。 建树+BFS#include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <queue> using原创 2017-11-26 22:30:58 · 272 阅读 · 0 评论