主要内容: 堆、最大堆、最小堆的基本概念 堆的操作:调整、创建、排序 采用堆实现优先级队列
基本概念 堆(heap)亦被称为:优先队列(priority queue) 逻辑定义:
n个元素序列{k1,k2...ki...kn},当且仅当满足下列关系时称之为堆: (ki = k2i,ki >= k2i...
分类:
其他好文 时间:
2014-05-19 08:45:41
阅读次数:
264
我们知道队列
就是在内容内存分配连续的内存空间,实现先进先出的逻辑,FIFO(LILO),这里用到了.net 4.0
的ConcurrentQueue类,(带线程安全的队列类),也可以用Queue ,多线程中自行同步。代码可直接复制运行 1 using System; 2
using System....
分类:
其他好文 时间:
2014-05-16 04:07:11
阅读次数:
276
根据5.2中的讲解,当监控high priority queue的PDSP channel设定好后,那么与之对应的event就知道了(PDSP channel与event一一对应),注意5.x讲的是中断的配置,并不是exception的配置,4.x讲的是exception。
中断event与ISR配置伪代码如下,目的是使event与ISR建立联系:
/*Configure ev...
分类:
其他好文 时间:
2014-05-15 23:41:39
阅读次数:
452
题目链接:点击打开链接
题意:给定n个点 m个询问
下面n-1行给定一棵树
m个询问 x y
问把树转成以x为根 y的父节点是谁
第一种情况lca==y那就是x的第 dep[x] - dep[y] -1 父亲,依次向上爬山坡,利用倍增的二进制加速。
第二种就是Father[y];
#include"cstdio"
#include"iostream"
#include"queue"
...
分类:
其他好文 时间:
2014-05-15 09:11:44
阅读次数:
397
平台:VS2010版本:1.04我们先看看消息队列的数据结构:typedefstructRAW_QUEUE
{
RAW_COMMON_BLOCK_OBJECTcommon_block_obj;
RAW_MSG_Qmsg_q;
RAW_VOID(*queue_send_notify)(structRAW_QUEUE*queue_ptr);
}RAW_QUEUE;RAW_MSG_Q:typedefstructRAW_MSG_Q{
RAW_VOID**queue_sta..
分类:
其他好文 时间:
2014-05-15 08:35:51
阅读次数:
318
1 #include 2 #include 3 using namespace std; 4 5
template class Queue; 6 template ostream & operator &); 7 8 template
class QueueItem...
分类:
其他好文 时间:
2014-05-15 02:01:47
阅读次数:
406
Implement strStr().Returns a pointer to the
first occurrence of needle in haystack, or null if needle is not part of
haystack.此题我觉得并不是真要你写出kmp算法。 指针暴力...
分类:
其他好文 时间:
2014-05-15 01:49:42
阅读次数:
330
【题目】
Implement regular expression matching with support for '.' and '*'.
'.' Matches any single character.
'*' Matches zero or more of the preceding element.
The matching should cover the entire input string (not partial).
The function prototype shoul...
分类:
其他好文 时间:
2014-05-14 21:36:52
阅读次数:
348
【题目】
Implement atoi to convert a string to an integer.
Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases.
Notes: It is intended for this problem to be s...
分类:
其他好文 时间:
2014-05-14 21:00:57
阅读次数:
304
c++ primer 模板与泛型编程 Queue模板的实现...
分类:
编程语言 时间:
2014-05-14 20:45:26
阅读次数:
362