![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
哈希
文章平均质量分 80
chAngE_AC
这个作者很懒,什么都没留下…
展开
-
字符串哈希函数
基本概念 所谓完美哈希函数,就是指没有冲突的哈希函数,即对任意的 key1 != key2 有h(key1) != h(key2)。 设定义域为X,值域为Y, n=|X|,m=|Y|,那么肯定有m>=n,如果对于不同的key1,key2属于X,有h(key1)!=h(key2),那么称h为完美哈希函数,当m=n时,h称为最小完美哈希函数(这个时候就是一一映射了)。 在处理大规模字符串数据时,转载 2015-08-13 08:01:34 · 374 阅读 · 0 评论 -
poj-3349 Snowflake Snow Snowflakes
Description You may have heard that no two snowflakes are alike. Your task is to write a program to determine whether this is really true. Your program will read information about a collection of s原创 2015-08-12 15:49:32 · 920 阅读 · 0 评论 -
poj-1840 Eqs 暴力+哈希
Description Consider equations having the following form: a1x13+ a2x23+ a3x33+ a4x43+ a5x53=0 The coefficients are given integers from the interval [-50,50]. It is consider a solution a system (x1原创 2015-08-17 10:46:28 · 880 阅读 · 0 评论 -
poj-2503 Babelfish
Description You have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand them.原创 2015-08-17 21:00:12 · 316 阅读 · 0 评论 -
poj-2002 Squares
题意很明确,有n个点,输入n个点的坐标x,y得出这些点能构成几个正方形。 思路:由于坐标很大直接存二维数组是肯定不行的,所以较为通用的方法是用哈希表,该题给的点的数量有点少,只有1000个点,有可能开一个1000的数组存点能过,不过还是推荐哈希表过。本人表头存法是用的坐标的平方和,表头开了1w+10,稍微大些来减少表中在查找的次数。并且对任意两点求另两点中,两点的选取作为对角点,求另两个原创 2015-08-17 16:11:41 · 436 阅读 · 0 评论