摘要:
哈希表是一种高效的数据结构。它的最大优点就是把数据存储和查找所消耗的时间大大降低,几乎可以看成是常数时间;而代价仅仅是消耗比较多的内存。然而在当前可利用内存越来越多、程序运行时间控制的越来越短的情况下,用空间换时间的做法还是值得的。另外,哈希表编码实现起来比较容易也是它的优点之一。哈希表的基本原理是:使用一个下标范围比较大的数组A来存储元素,设计一个函数h,对于要存储的线性表的每个元素node,取一个关键字key,算出一个函数值h(key),把h(key)作为数组下标,用A[h(key)]这个数组单元来存储node。也可以简单的理解为,按照关键字为每一个元素“分类”,然后将这个元素存储在相应. 阅读全文
阅读排行榜
C#中的委托例子,备查
2008-05-10 12:26 by OntheMars, 174 阅读, 收藏,
摘要:
usingSystem;usingSystem.Collections.Generic;usingSystem.Text;namespacedelegateExp1...{classProgram...{delegatevoidSimpleDelegate();staticvoidF()...{System.Console.WriteLine("helloworld");}staticvoidMultiCall(SimpleDelegated,intcount)...{for(inti=0;i<count;i++)d();}staticvoidMain(string[ 阅读全文
字符串与数之间转换函数
2008-02-18 14:48 by OntheMars, 167 阅读, 收藏,
摘要:
转自 &豪 - C++博客字符串与数之间转换函数 atof(将字符串转换成浮点型数) 相关函数 atoi,atol,strtod,strtol,strtoul 表头文件 ... 阅读全文
凸包(类实现)
2008-02-18 01:44 by OntheMars, 167 阅读, 收藏,
摘要:
凸包(类实现) /**//*************************************************************************Author:WHU_GCCCreatedTime:2007-8-1313:59:37FileName:convex_hull.cppDescription:************************************************************************/#include<iostream>usingnamespacestd;#defineout(x)(cout&l 阅读全文
数的划分
2008-02-18 01:40 by OntheMars, 167 阅读, 收藏,
摘要:
转自 农夫三拳 的blog数的划分 /**//*http://acm.hnu.cn:8080/online/?action=problem&type=show&id=10390*/#include <iostream>#include <vector>using namespace std;long long r[221][11][221];int f(int m, int n, int c){ //只要分成两列,在首位数字确定的情况下只可能有一种分法 if( n <= 2 ) return 1; int i; int result = 0; in 阅读全文
浙公网安备 33010602011771号