摘要:
选择键值,冲突的时候采取不同的策略散列函数:简单的散列函数:1 int hash(const string & key,int tableSize)2 {3 int hashVal = 0;4 for(int i = 0; i < key.length();++i)5 {6 hashVal + = key[i];7 }8 return hashVal % tableSize;9 }比较好的散列函数: 1 int hash( const string & key,int tableSize ) 2 { 3 int hashVal =... 阅读全文
posted @ 2012-09-21 20:57
xingoo
阅读(345)
评论(0)
推荐(0)
摘要:
Number SequenceTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 63888Accepted Submission(s): 14701Problem DescriptionA number sequence is defined as follows:f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.Given A, B, and n, you are to 阅读全文
posted @ 2012-09-21 00:02
xingoo
阅读(279)
评论(0)
推荐(0)

浙公网安备 33010602011771号