2014年11月5日

hash查找

摘要: #include#include#includeusing namespace std; #define HASHSIZE 7#define NULLKEY -32768 struct HashTable{ int *elem; int count;};void init(HashTable* ha... 阅读全文

posted @ 2014-11-05 22:00 kangbry 阅读(167) 评论(0) 推荐(0) 编辑

堆排序算法

摘要: #include using namespace std; //获取父节点 int Parent(int i) { return i/2; } //获取左孩子 int Left(int i) { return 2*i; } //获取右孩子 int Right(i... 阅读全文

posted @ 2014-11-05 21:43 kangbry 阅读(132) 评论(0) 推荐(0) 编辑

共享内存生产者消费者模型

摘要: 阅读全文

posted @ 2014-11-05 21:21 kangbry 阅读(161) 评论(0) 推荐(0) 编辑

生成者消费者(线程同步,互斥,条件变量)

摘要: #include #include "stdio.h"#include #include #define N_CONSUMER 3 //消费者数量#define N_PRODUCER 2 //生产者数量#define C_SLEEP 1 //控制 consumer 消费的节奏#define P_SL... 阅读全文

posted @ 2014-11-05 20:50 kangbry 阅读(180) 评论(0) 推荐(0) 编辑

导航