PriorityQuenue
优先队列就是作业调度类的ADT,这里用二叉堆来实现。
优先队列最少有两个操作:插入(Insert)和删除最小者(DeleteMin)。
插入操作图解:
图片来源:www.educity.cn
删除操作图解:
图片来源:www.cfanz.cn
代码实现:
//
// main.cpp
// binaryHeap
//...
分类:
其他好文 时间:
2014-08-19 12:59:04
阅读次数:
323
贪心 ~~使用优先队列#include #include #include #include #include #include #include #include #include #include #include #include #include #define FFI freopen("i...
分类:
其他好文 时间:
2014-08-19 12:34:14
阅读次数:
186
优先队列实现完整哈夫曼树,一大段英文都是介绍哈夫曼树的。
外面用了一个pre来找parent,其实可以把这个项放入结构体中。
特别注意当有一个结点的情况不能用优先队列,另外判断下
#include
#include
#include
#include
#include
#include
using namespace std;
#define maxn 256
s...
分类:
其他好文 时间:
2014-08-18 14:36:12
阅读次数:
198
畅通工程续
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 28578 Accepted Submission(s): 10382
Problem Description
某省自从实行了很多年的畅通工程计划后...
分类:
其他好文 时间:
2014-08-18 09:17:33
阅读次数:
229
Expedition
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 6890
Accepted: 2065
Description
A group of cows grabbed a truck and ventured on an expedition de...
分类:
其他好文 时间:
2014-08-17 19:59:02
阅读次数:
1506
Til the Cows Come Home
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 30007
Accepted: 10092
Description
Bessie is out in the field and wants to get back t...
分类:
其他好文 时间:
2014-08-17 15:35:32
阅读次数:
226
Remmarguts' Date
Time Limit: 4000MS
Memory Limit: 65536K
Total Submissions: 21084
Accepted: 5740
Description
"Good man never makes girls wait or breaks an appointment...
分类:
其他好文 时间:
2014-08-17 14:22:12
阅读次数:
250
1306. Sequence Median
Time limit: 1.0 second
Memory limit: 1 MB
Language limit: C, C++, Pascal
Given a sequence of N nonnegative integers. Let's define the median of such sequence. If N is...
分类:
其他好文 时间:
2014-08-15 21:13:00
阅读次数:
247
Open the Lock
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 4253 Accepted Submission(s): 1858
Problem Description
Now an emerg...
分类:
其他好文 时间:
2014-08-15 12:55:38
阅读次数:
312