![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
9‘’数据结构——树、堆、并查集
文章平均质量分 61
青年小陈陈
这个作者很懒,什么都没留下…
展开
-
1079. Total Sales of Supply Chain (25)--dfs
#include #include #include #include #include #include #include #include #include #include #include #include using namespace std;int N;double p,r;struct node{ vector child;};no原创 2018-03-08 16:29:44 · 123 阅读 · 0 评论 -
1107. Social Clusters (30)--查并集
#include <cstdio>#include <cstdlib>#include <iostream>#include <algorithm>#include <string>#include <cstring>#include <vector>#include <queue&a原创 2018-03-13 00:06:14 · 105 阅读 · 0 评论 -
1143. Lowest Common Ancestor (30)---一个点超时
#include <iostream>#include <algorithm>#include <cstdlib>#include <cstdio>#include <cstring>#include <string>#include <map>#include <vector&原创 2018-03-18 21:25:16 · 268 阅读 · 0 评论 -
1021. Deepest Root (25)
#include <cstdio>#include <cstdlib>#include <iostream>#include <algorithm>#include <string>#include <cstring>#include <vector>#include <queue&a原创 2018-03-11 00:02:34 · 114 阅读 · 0 评论 -
1098. Insertion or Heap Sort (25)--堆排序
#include <cstdio>#include <cstdlib>#include <iostream>#include <algorithm>#include <string>#include <cstring>#include <vector>#include <queue&a原创 2018-03-10 18:54:57 · 115 阅读 · 0 评论 -
1123. Is It a Complete AVL Tree (30)
#include #include #include #include #include #include #include #include #include #include #include #include using namespace std;struct node{ int data,h; int level; int id;原创 2018-03-09 21:53:33 · 102 阅读 · 0 评论 -
1066. Root of AVL Tree (25)--AVL树
#include #include #include #include #include #include #include #include #include #include #include #include using namespace std;struct node{ int data,h; node* l; node* r;原创 2018-03-09 16:29:30 · 219 阅读 · 0 评论 -
1043. Is It a Binary Search Tree (25)--BST引用插入、二叉树遍历模板
#include #include #include #include #include #include #include #include #include #include #include #include using namespace std;int N;vector v1,vpre,vmir;struct node{ int data;原创 2018-03-09 00:45:18 · 134 阅读 · 0 评论 -
1053. Path of Equal Weight (30)
#include #include #include #include #include #include #include #include #include #include #include #include using namespace std;int N,M,S;int weight[200]={0};struct node{ vector原创 2018-03-08 18:14:05 · 102 阅读 · 0 评论 -
1004. Counting Leaves (30)--dfs
#include #include #include #include #include #include #include #include #include #include #include #include using namespace std;int N,M;struct node{ vector child;}cube[200];in原创 2018-03-08 16:55:45 · 168 阅读 · 0 评论 -
Zigzag打印二叉树
题目描述请实现一个函数按照之字形打印二叉树,即第一行按照从左到右的顺序打印,第二层按照从右至左的顺序打印,第三行按照从左到右的顺序打印,其他行以此类推。思路:在原来的广搜基础上,按照每层的节点数量(即q.size())进行分组操作,一批一批来。/*struct TreeNode { int val; struct TreeNode *left; struct...原创 2019-04-06 11:57:07 · 325 阅读 · 0 评论