![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
二叉树
hu的小金库
正在编程路上走
展开
-
二叉树--基本知识点
数据结构实验之二叉树二:遍历二叉树 Problem Description 已知二叉树的一个按先序遍历输入的字符序列,如abc,,de,g,,f,,,(其中,表示空结点)。请建立二叉树并按中序和后序的方式遍历该二叉树。 Input 连续输入多组数据,每组数据输入一个长度小于50个字符的字符串。 Output 每组输入数据对应输出2行: 第1行输出中序遍历序列; 第2行输出后序遍历序列...原创 2018-08-20 10:56:58 · 173 阅读 · 0 评论 -
二叉排序树
二叉排序树 Problem Description 二叉排序树的定义是:或者是一棵空树,或者是具有下列性质的二叉树: 若它的左子树不空,则左子树上所有结点的值均小于它的根结点的值; 若它的右子树不空,则右子树上所有结点的值均大于它的根结点的值; 它的左、右子树也分别为二叉排序树。 今天我们要判断两序列是否为同一二叉排序树 Input 开始一个数n,(1<=n<=20) 表示有n...原创 2018-08-20 10:54:52 · 74 阅读 · 0 评论 -
平衡二叉树+图片讲解
struct node *LL(struct node *root) { struct node *a = root; struct node *b = root->left; a->left = b->right; b->right = a; a->high = max(height(a->left), heigh...原创 2018-08-20 19:59:57 · 241 阅读 · 0 评论 -
堆的基础知识点
1、向下调整。 void siftdown(int i) { int t, flag = 0; while(i*2<=n && flag = 0) { if(h[i]>h[i*2]) t = i*2; else t = i; if(i*2+1<...原创 2018-08-22 10:18:54 · 149 阅读 · 0 评论 -
线段树(模板)
目前就知道这些,以后遇到其他题在自行补充。。。 只有自己用过才真正属于自己!!! #include <iostream> #include <cstdio> #include <string> using namespace std; typedef long long ll; ll ans; struct node { ll l, r, w, f; ...原创 2018-10-15 13:27:20 · 114 阅读 · 0 评论 -
Mayor's posters POJ - 2528 (线段树+离散化+区间更新)
https://cn.vjudge.net/problem/POJ-2528 #include <stdio.h> #include <algorithm> #include <math.h> #include <cstring> using namespace std; const int maxn = 10010; struct cnode ...原创 2018-10-17 15:13:44 · 136 阅读 · 0 评论