摘要: //by zxfx100//(sizeof a = n) && (heap = a[1..n]) && (a[0] is null) && (range is int)class MinHeap{public:int a[32768], n;void build(){ n = 0;}void insert(int element){ a[++n] = element; int i = n; while(i > 1) { int j = i >> 1; if(a[i] < a[j]) swap(a[i], a[j])... 阅读全文
posted @ 2013-04-03 23:58 zxfx100 阅读(198) 评论(0) 推荐(0) 编辑
摘要: //by zxfx100//(positive int # < maxN = 9999997) && (elements' range is int)#define maxN 9999997int HashTablea[maxN];int HashTablecnt[maxN];class HashTable{public:void init(){ memset(HashTablecnt, 0, sizeof(HashTablecnt));}int find(int n){ int index = n % maxN; index = (index + maxN) % 阅读全文
posted @ 2013-04-03 18:38 zxfx100 阅读(241) 评论(0) 推荐(0) 编辑