![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Hash
文章平均质量分 77
开拓的博客
这个作者很懒,什么都没留下…
展开
-
DS | Hash | Summary
Hash核心思想:以常数时间完成查找基本问题:如何把关键字Key映射到它存放的位置?(Hash函数)两个关键字位置相同时怎么处理?(冲突解决)Hash函数整数的Hash函数直接定址法 H(key) = a x key + b除留余数法H(key) = key % pp最好是素数数字分析法适用于手机号、身份证号等可以先存成字符串,用atoi()将某些位变成整数,或者key[i]-原创 2015-09-09 13:29:42 · 420 阅读 · 0 评论 -
[DS][Hash][PAT][Hashing]
11-散列2 Hashing (25分)The task of this problem is simple: insert a sequence of distinct positive integers into a hash table, and output the positions of the input numbers. The hash function is原创 2015-09-06 17:17:08 · 702 阅读 · 0 评论 -
[DS][Hash][PAT][电话聊天狂人]
11-散列1 电话聊天狂人 (25分)给定大量手机用户通话记录,找出其中通话次数最多的聊天狂人。输入格式:输入首先给出正整数N(≤105),为通话记录条数。随后N行,每行给出一条通话记录。简单起见,这里只列出拨出方和接收方的11位数字构成的手机号码,其中以空格分隔。输出格式:在一行中给出聊天狂人的手机号码及其通话次数,其间以空格分隔。如果这原创 2015-09-06 16:37:18 · 1953 阅读 · 0 评论 -
[DS][Hash][PAT][Hashing Hard Version]
11-散列4 Hashing - Hard Version (30分)Given a hash table of size N, we can define a hash function . Suppose that the linear probing is used to solve collisions, we can easily obtain the statu原创 2015-09-07 12:44:28 · 2545 阅读 · 0 评论