acm(二叉树)
题目
不会编程怎么行
fighting
展开
-
E - 求二叉树的层次遍历
```cpp#include<bits/stdc++.h>using namespace std;struct node{char data;node *lchild;node *rchild;};node *creat(char first[],char mid[],int len){if(len<=0)return NULL;node *t = ne...原创 2020-01-10 09:21:50 · 272 阅读 · 1 评论 -
G - 数据结构实验之二叉树三:统计叶子数
#include<bits/stdc++.h>using namespace std;char pre[1000];int sum=0,i=0;struct node{ char data; node *lchild; node *rchild;};node *creat(){ node *root; char ch = pre...原创 2020-01-10 09:20:24 · 137 阅读 · 0 评论 -
H - 数据结构实验之二叉树四:(先序中序)还原二叉树
#include<bits/stdc++.h>using namespace std;struct node{ char data; node *lchild; node *rchild;};node *creat(char first[],char mid[],int len){ if(len<=0) return ...原创 2020-01-10 09:18:46 · 170 阅读 · 0 评论 -
遍历二叉树
https://paste.ubuntu.com/p/DMhW5MmbNG/原创 2020-05-06 10:42:12 · 102 阅读 · 0 评论 -
求二叉树的先序遍历
#include<bits/stdc++.h>using namespace std;struct tree_node{ tree_node *left_tree,*right_tree; char data;};tree_node *create(char middle[],char finall[],int len){ if(len<=0...原创 2020-05-06 10:41:59 · 117 阅读 · 0 评论 -
数据结构上机测试4.1:二叉树的遍历与应用1
#include<bits/stdc++.h>using namespace std;struct node{ char data; node *lchild,*rchild;};node *creat(char first[],char mid[],int len){ if(len<=0) return NULL; ...原创 2020-05-06 10:41:51 · 109 阅读 · 0 评论 -
排序二叉树
https://paste.ubuntu.com/p/m8xPTG85WB/https://paste.ubuntu.com/p/g6cq9gRTMC/原创 2020-05-06 10:41:39 · 97 阅读 · 0 评论 -
平衡二叉树
https://paste.ubuntu.com/p/YD7B4DStKg/原创 2020-05-06 10:41:30 · 89 阅读 · 0 评论 -
二叉排序树
#include<bits/stdc++.h>using namespace std;struct node{ int data; node *lchild,*rchild;};int flag;node *creat(node *root,int x){ if(root == NULL) { root = new nod...原创 2020-05-06 10:41:15 · 273 阅读 · 1 评论 -
二叉搜索树2
#include<bits/stdc++.h>using namespace std;struct node{ int data; node *lchild,*rchild;};void insertt(node *&tree,int value)//注意要加&(取地址符)才能每次更新tree 否则不能实现对tree的改变(相当 ...原创 2019-12-13 21:28:53 · 67 阅读 · 0 评论 -
C - 数据结构实验之查找一:二叉排序树
#include <bits/stdc++.h>using namespace std;int cnt,n;struct node{ int data; node *lchild; node *rchild;};node *creat(node *tree,int x){ if(tree==NULL) { tree...原创 2020-01-14 10:43:39 · 127 阅读 · 0 评论