一个循环队列的C语言实现,数据类型Queue定义如下,注意在 typedef struct{...}Queue; 中Queue为数据类型,而在struct {...}Queue; 中Queue为一个变量名。
front 为队首元素下标,始终指向队首元素,tail 为队尾元素的下一个位置的下标。初始状态为front=tail=0typedef struct {
int size,eleNum...
分类:
其他好文 时间:
2015-06-22 15:05:36
阅读次数:
153
msg消息队列,实线不同进程之间的通信,主要依靠key来识别:发送端 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8 #include 9 struct msgmbuf{10...
分类:
其他好文 时间:
2015-06-22 12:22:47
阅读次数:
97
题目意思:用队列实现栈,push(),pop(),top(),empty()思路:用两个queue,pop时将一个queue的元素pop再push到另一个队列,queue只留最后一个元素,并pop,再将目标队列变为另一个 ps:用栈实现队列,参考剑指offer 1 class Stack { 2 ....
分类:
其他好文 时间:
2015-06-17 10:52:17
阅读次数:
85
问题描述:Implement the following operations of a stack using queues.push(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack....
分类:
其他好文 时间:
2015-06-16 12:27:06
阅读次数:
126
生产者-消费者模问题/** * 使用阻塞队列实现生产者-消费者模型 * 阻塞队列只允许元素以FIFO的方式来访问 * @author Bingyue * */public class ProducerCustomerPattern { public static void main(String.....
分类:
其他好文 时间:
2015-06-16 12:26:56
阅读次数:
211
用queue实现stack题目要求:Implement the following operationspush(x) -- Push element x onto stack.pop() -- Removes the element on top of the stack.top() -- Get...
分类:
其他好文 时间:
2015-06-13 07:35:36
阅读次数:
209
1、工作队列的使用
按惯例,在介绍工作队列如何实现之前,先说说如何使用工作队列实现下半部。
步骤一、定义并初始化工作队列:
创建工作队列函数:
struct workqueue_struct *create_workqueue(const char *name)
函数传参是内核中工作队列的名称,返回值是workqueue_struct结构体的指针,该结构体用来维护一个等待队列。
我的代码如下:
struct workqueue_struct * ZP1015_wq; //定义工作队列
ZP101...
分类:
系统相关 时间:
2015-06-03 17:48:40
阅读次数:
172
队列实现广度优先遍历#include #include using namespace std;int visit[5]={0};typedef struct { char vexs[5]; int AdjMatrix[5][5]; int vexnum;...
分类:
其他好文 时间:
2015-06-03 17:34:30
阅读次数:
124
解题思路:
广度遍历而且要记录每一层。广度遍历利用队列实现,记录用列表实现
使用一个列队,一个列表。 列队用于记录每一层节点,列表用于存储每一层的节点...
分类:
其他好文 时间:
2015-06-03 11:59:49
阅读次数:
80
解题思路:
广度遍历而且要记录每一层。广度遍历利用队列实现,记录用列表实现
使用一个列队,一个列表。 列队用于记录每一层节点,列表用于存储每一层的节点
Binary Tree Level Order Traversal Total Accepted: 51429 Total Submissions: 174478
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to rig...
分类:
其他好文 时间:
2015-06-03 10:03:00
阅读次数:
129