几个常用的字符串Hash函数如下:
SDBMHash函数
unsigned int SDBMHash(char *str)
{
unsigned int hash = 0;
while (*str)
{
// equivalent to: hash = 65599*hash + (*str++);
hash = (*str++) +...
分类:
其他好文 时间:
2015-08-10 14:58:20
阅读次数:
130
5.互斥量(Mutex)#pragma once#define _CRTDBG_MAP_ALLOC#include#include#include#includeunsigned int count = 0;const unsigned int threadnum = 50;HANDLE Mutex...
分类:
编程语言 时间:
2015-08-10 13:34:56
阅读次数:
198
#include
#include
#include
#define infinity 10000 //定义一个无限大的值
//哈夫曼树类型定义
typedef struct{
unsigned int weight;
unsigned int parent,lchild,rchild;
}HTNode,*HuffmanTree;
typedef char **HuffmanCode;//...
分类:
其他好文 时间:
2015-08-10 00:24:34
阅读次数:
130
Implement int sqrt(int x).
Compute and return the square root of x.
1. 二分法:
用unsigned long long。最后返回值还要再检查一下。
class Solution {
public:
int mySqrt(int x) {
unsigned long long be...
分类:
其他好文 时间:
2015-08-09 18:50:31
阅读次数:
179
转载请标明地址:http://www.cnblogs.com/wangmengmeng/效果图:通项公式:An=3的N-1次方源代码: 1 #include 2 #include 3 #include 4 5 void main() 6 { 7 srand((unsigned)tim...
分类:
其他好文 时间:
2015-08-09 18:32:03
阅读次数:
103
23.3.2以非阻塞方式工作的TCP聊天室客户端(1)WSAAsyncSelect函数——设置非阻塞模式参数含义SOCKET s套接字句柄HWND hWnd套接字的通知消息将被发往的hwnd的窗口过程unsigned int wMsg自定义通知消息的编号,如#define WM_SOCKET WM_...
分类:
其他好文 时间:
2015-08-09 17:02:24
阅读次数:
176
http://poj.org/problem?id=1426/*暴力发现最大数目不超过19位,开unsigned long long 水过*//************************************************* Author :Powatr* Creat...
分类:
其他好文 时间:
2015-08-09 17:00:31
阅读次数:
111
题目大意:给了一个2^E的前缀n,已知前缀n的位数不到2^E的位数的一半,找出满足条件的最小E。题目解析:设2^E为i位数,则有n*10^i# include# include# include# includeusing namespace std;void work(unsigned n){ ....
分类:
其他好文 时间:
2015-08-09 15:21:50
阅读次数:
154
SQL – foreign keySQL – foreign keyTable of Contents父表和子表的行为父表和子表同步的例子优点:保持数据一致性, 完整性实现一对一或者一对多的关系对两个表的要求:必须使用相同的存储引擎 – InnoDB数字长度, 是否是 unsigned 的属性相同字...
分类:
数据库 时间:
2015-08-09 13:50:22
阅读次数:
175
头文件:
#ifndef __HASHTABLE_H
#define __HASHTABLE_H
/*********************(平方)开放定址散列法***************/
//如果有冲突发生,那么就尝试另外的单元,直到找到空的单元为止
typedef unsigned int index;
typedef index position;
typedef int E...
分类:
编程语言 时间:
2015-08-09 12:35:21
阅读次数:
266