【Description】
A queue is a collection that implements the first-in-first-out protocal. This means that the only accessiable object in the collection in the first one that was inserted. The most commo...
分类:
其他好文 时间:
2014-08-10 21:43:10
阅读次数:
236
Statements: This blog was written by me, but most of content is quoted from book【Data Structure with Java Hubbard】
【Description】
This simulationillustrates objectoriented programming...
分类:
其他好文 时间:
2014-08-10 21:42:20
阅读次数:
450
输入:8 91 21 32 42 53 63 74 85 86 7// 图的BFS,使用C++队列#include #include #include using namespace std;#define N 10int g[N][N],bz[N],n,m;queue q;void BFS(in....
分类:
其他好文 时间:
2014-08-10 21:16:50
阅读次数:
247
greater 从小到大lesser 总大到小#include#includeusing namespace std;int main(){ int n,m,t,x,y; long long s; priority_queue ,greater > my; cin>>n; ...
分类:
其他好文 时间:
2014-08-10 21:09:40
阅读次数:
280
STL的队列和栈简单使用 #include #include #include #include #include #include using namespace std;int main(){ queue Q; stack S; int i; for(i=1;i M //例如 queue ...
分类:
其他好文 时间:
2014-08-10 21:04:50
阅读次数:
201
Team QueueQueues and Priority Queues are data structures which are known to most computer scientists. The Team Queue, however, is not so well known, ....
分类:
其他好文 时间:
2014-08-10 18:13:30
阅读次数:
328
解题报告
题意:
看输入输出就很明白。
思路:
优先队列。
#include
#include
#include
#include
#include
#include
#include
#include
using namespace std;
struct node {
char m[100];
int v,k;
friend bool ope...
想必大家都很熟悉生产者-消费者队列,生产者负责添加元素到队列,如果队列已满则会进入阻塞状态直到有消费者拿走元素。相反,消费者负责从队列中拿走元素,如果队列为空则会进入阻塞状态直到有生产者添加元素到队列。BlockingQueue就是这么一个生产者-消费者队列。BlockingQueue是Queue的...
分类:
编程语言 时间:
2014-08-09 18:09:28
阅读次数:
255
题意:不解释。
策略:如题;
这道题可以用深搜也可以用广搜,我以前写的是用的深搜,最近在学广搜,就拿这道题来练练手。
代码:
#include
#include
#include
using std::queue;
bool vis[20][20];
const int dir[4][2] = {1, 0, -1, 0, 0, 1, 0, -1};//四个方向
int map[9][9]...
分类:
其他好文 时间:
2014-08-09 11:38:27
阅读次数:
155
这是做的第一道BFS,很基础很简单的题目广度优先搜索算法如下:(用QUEUE)(1) 把初始节点S0放入Open表中;(2) 如果Open表为空,则问题无解,失败退出;(3) 把Open表的第一个节点取出放入Closed表,并记该节点为n;(4) 考察节点n是否为目标节点。若是,则得到问题的解,成功...
分类:
其他好文 时间:
2014-08-09 02:32:26
阅读次数:
307