![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
哈希
zadarmo_
这个作者很懒,什么都没留下…
展开
-
1145 Hashing - Average Search Time (25 分)——甲级(哈希:除留余数法、平方探测法)
The task of this problem is simple: insert a sequence of distinct positive integers into a hash table first. Then try to find another sequence of integer keys from the table and output the average sea...原创 2019-08-19 18:20:10 · 202 阅读 · 0 评论 -
11-散列3 QQ帐户的申请与登陆 (25 分)(哈希/map)
实现QQ新帐户申请和老帐户登陆的简化版功能。最大挑战是:据说现在的QQ号码已经有10位数了。 输入格式: 输入首先给出一个正整数N(≤10 5 ),随后给出N行指令。每行指令的格式为:“命令符(空格)QQ号码(空格)密码”。其中命令符为“N”(代表New)时表示要新申请一个QQ号,后面是新帐户的号码和密码;命令符为“L”(代表Login)时表示是老帐户登陆,后面是登陆信息。QQ号码为一个不...原创 2019-08-21 15:26:56 · 1167 阅读 · 3 评论 -
11-散列1 电话聊天狂人 (25 分)(哈希:除留余数法、分离链接法)
(第一次接触哈希,先从一个一个题目开始慢慢理解吧 。。) 给定大量手机用户通话记录,找出其中通话次数最多的聊天狂人。 输入格式: 输入首先给出正整数N(≤105),为通话记录条数。随后N行,每行给出一条通话记录。简单起见,这里只列出拨出方和接收方的11位数字构成的手机号码,其中以空格分隔。 输出格式: 在一行中给出聊天狂人的手机号码及其通话次数,其间以空格分隔。如果这样的人不唯一,则输出狂人中最...原创 2019-08-17 21:47:00 · 774 阅读 · 0 评论 -
11-散列4 Hashing - Hard Version (30 分)(哈希+拓扑排序+优先队列)
Given a hash table of size N, we can define a hash function H(x)=x%N. Suppose that the linear probing is used to solve collisions, we can easily obtain the status of the hash table with a given sequen...原创 2019-08-22 20:59:11 · 331 阅读 · 0 评论 -
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 defined to be H(key)=key%TSiz...原创 2019-08-18 10:50:00 · 845 阅读 · 0 评论