hash_map和map的用法很相似,只是底层机制有所不同。
hash_map容器采用的底层机制是hash table代码:
template ,
class EqualKey = equal_to,
class Alloc = alloc>
class hash_map
{
private:
typedef hashtable, Key...
分类:
其他好文 时间:
2014-05-13 22:59:23
阅读次数:
256
题目来源:POJ 1006 Biorhythms
题意:给出3个周期第一次发生的时间 和 当前开始的天数 求三个周期下一次到达高峰期发生在哪一天
思路:这题很水 试一下我的模版而已
#include
#include
using namespace std;
typedef long long LL;
const int maxn = 10;
int a[maxn], m[maxn];
...
分类:
其他好文 时间:
2014-05-13 05:07:28
阅读次数:
253
其题目如下:#pragma pack(2)class A{public: int
i; union U { char buff[13]; int i; }u; void foo() { } typedef char*
(*f)(void*); enum{red, green, blue} ...
分类:
其他好文 时间:
2014-05-12 21:18:19
阅读次数:
321
typedef enum
//{
// GPIO_PIN_0 = ((u8)0x01), /*!
// GPIO_PIN_1 = ((u8)0x02), /*!
// GPIO_PIN_2 = ((u8)0x04), /*!
// GPIO_PIN_3 = ((u8)0x08), /*!
// GPIO_PIN_4 = ((u8)0x1...
分类:
其他好文 时间:
2014-05-11 07:10:01
阅读次数:
517
//链表操作:建立、插入、删除、查找、倒置、删除等基本操作
#include
#include
typedef
struct LNode
{
int data;
structLNode *next;
}LNode,*Llist;
LNode *creat_head();//创建一个空表
void creat_list(LNode *,int);//创...
分类:
其他好文 时间:
2014-05-11 03:33:11
阅读次数:
351
在下例中,演示了链表的各种操作
#include
using namespace std;
typedef struct Node
{
int data; //数据域
struct Node * next; //指针域
}NODE, *PNODE; //NODE相当于struct Node, PNODE相当于struct Node *
PNODE CreateList()...
分类:
其他好文 时间:
2014-05-10 04:29:49
阅读次数:
263
Redis的client设计如下:
/* With multiplexing we need to take per-clinet state.
* Clients are taken in a liked list. */
typedef struct redisClient {
int fd;
redisDb *db;
int dictid;
sds que...
分类:
其他好文 时间:
2014-05-10 03:44:21
阅读次数:
292
相关性质 可查看维基百科"二叉查找树"关键性质:设root为二叉查找树的结点
如果a是root的左结点 key[a] 2 #include 3 using namespace std; 4 /*二叉查找树*/ 5
/*实现中假设关键元素互不相同*/ 6 typedef i...
分类:
其他好文 时间:
2014-05-10 02:28:24
阅读次数:
630
BFS。 1 #include 2 #include 3 #include 4
#include 5 using namespace std; 6 7 #define INF 0x3fffffff 8 9 typedef struct
node_st {10 int x, y, ...
分类:
其他好文 时间:
2014-05-09 20:18:48
阅读次数:
339
一、sizeof sizeof(...)是运算符,在头文件中typedef为unsigned
int,其值在编译时即计算好了,参数可以是数组、指针、类型、对象、函数等。 它的功能是:获得保证能容纳实现所建立的最大对象的字节大小。
由于在编译时计算,因此sizeof不能用来返回动态分配的内存空间的大小...
分类:
其他好文 时间:
2014-05-09 16:11:21
阅读次数:
267