摘要: 优先队列 优先队列与普通队列不同之处在于我们可以自定义元素的优先级高低,来决定谁先出队列。 基本操作与queue大致相同,底层是一个堆来实现的。 top() 返回队首元素 empty() 判空 size() 返回队列元素个数 push() 队尾插入元素(并排序) pop() 弹出队首元素 swap( 阅读全文
posted @ 2020-08-14 11:14 不敢说的梦 阅读(131) 评论(0) 推荐(0)
摘要: 题目链接: ZOJ 2724 Describe: Message queue is the basic fundamental of windows system. For each process, the system maintains a message queue. If somethin 阅读全文
posted @ 2020-08-14 11:09 不敢说的梦 阅读(166) 评论(0) 推荐(0)
摘要: 题目链接:POJ 2309 Describe: Consider an infinite full binary search tree (see the figure below), the numbers in the nodes are 1, 2, 3, .... In a subtree w 阅读全文
posted @ 2020-08-13 13:24 不敢说的梦 阅读(122) 评论(0) 推荐(0)
摘要: 题目链接: POJ 2455 Describe: Little Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees 阅读全文
posted @ 2020-08-12 12:23 不敢说的梦 阅读(89) 评论(0) 推荐(0)
摘要: 题目链接: POJ 2499 Describe: Background Binary trees are a common data structure in computer science. In this problem we will look at an infinite binary t 阅读全文
posted @ 2020-08-12 08:36 不敢说的梦 阅读(212) 评论(0) 推荐(0)
摘要: 题目传送:POJ 1703 Describe: The police office in Tadu City decides to say ends to the chaos, as launch actions to root up the TWO gangs in the city, Gang 阅读全文
posted @ 2020-08-10 12:58 不敢说的梦 阅读(183) 评论(0) 推荐(0)
摘要: 并查集模板题目: P3367 普通并查集模板: 初始化: 并查集数组每个元素初始自成一个集合,所以每个元素的值为其本身。所处的树的深度初始化为1 1 void init(int n) 2 { 3 for(int i = 1; i <= n; i++) 4 { 5 f[i] = i; 6 r[i] = 阅读全文
posted @ 2020-08-10 12:29 不敢说的梦 阅读(183) 评论(0) 推荐(0)
摘要: 题目通道:POJ 1330 Describe: A rooted tree is a well-known data structure in computer science and engineering. An example is shown below: In the figure, ea 阅读全文
posted @ 2020-08-09 13:04 不敢说的梦 阅读(139) 评论(0) 推荐(0)
摘要: 定义: 树是n(大于零)个节点的有限集,集合满足以下条件: 1、有且仅有一个节点没有前节点(父节点)该节点称为树的根。 2、除根以外,其它每个节点都有且仅有一个前节点。 3、除根以外,每一个节点都通过唯一的路径连接到根。这条路径由根开始,而末端就是该节点,并除根以外,路径上每一个节点都是前一个节点的 阅读全文
posted @ 2020-08-09 12:44 不敢说的梦 阅读(305) 评论(0) 推荐(0)
摘要: vector基本用法: vector是一种向量类型,可容纳多种数据类型,使用需包含头文件<vector> vector的构造: 1 #include <iostream> 2 #include <vector> 3 using namespace std; 4 int main() 5 { 6 ve 阅读全文
posted @ 2020-08-09 11:24 不敢说的梦 阅读(232) 评论(0) 推荐(0)