哈希函数 [英] Hash Function

查看:86
本文介绍了哈希函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做我的任务,但遗憾的是我知道怎么做...请帮助我b4 19april2010

编码一个哈希函数,它根据MMU ID计算索引号,这是
a 10位数密钥。用于计算哈希索引的哈希算法如下:

?将10位数字键(yyyyyzzzzz)分成两个5位数字:yyyyy和

zzzzz。

?添加两个分区的数字,yyyyy和zzzzz。

?截断加法结果,并仅保留最后三位数。

使用下面给出的函数头。该函数将接受一个无符号整数,ID

,它存储MMU ID,相应地计算并返回计算的哈希索引。

int hashfunc(unsigned int ID);

你的MMU ID是多少? ______________________

什么是基于您的MMU ID的哈希索引? ______________________

im doing my assignment,,but sadly i dnt knw how to do...help me please b4 19april2010
Code a hash function, which computes the index number based on the MMU ID, which is
a 10-digit key. The hashing algorithm used to compute the hash index is given as follows:
? Partition the 10-digit key (yyyyyzzzzz) into two 5-digit numbers: yyyyy and
zzzzz.
? Add the two partitioned numbers, yyyyy and zzzzz.
? Truncate the addition result, and keep only the last three digits.
Use the function header given below. The function will accept an unsigned integer, ID
which stores the MMU ID, compute accordingly and return the computed hash index.
int hashfunc(unsigned int ID);
What is your MMU ID? ______________________
What is the hash index based on your MMU ID? ______________________

推荐答案

'b4''是什么意思?那么,你如何将10位数字(例如9 bil。)塞进unsigned int(也就是说,我认为,在大多数平台上都是32位)?要提取更高的部分,你可以使用modulo(%)运算符。
What does that ''b4'' thingie mean? Then, how are you going to jam 10-digit number ( e.g. 9 bil. ) into unsigned int ( that is, I assume, 32-bit on most platforms)? To extract higher part, you can use modulo(%) operator.


好吧,我必须通过这个星期一...我完全鄙视...

10位数的平均值,如果输入的身份证号码是1231112020.

则分为yyyyy和xxxxx两部分。

请帮助我...我的编程很糟糕=( (
well,i have to submit by this monday..and im totally desprate..
the 10 digit mean,if the id number entered is 1231112020.
then divided into two parts of yyyyy and xxxxx.
help me please..im bad in programming =((


我有点意识到10位数字是什么。我的问题是选择 - " int hashfunc(unsigned int ID);"< - 这个原型为函数 - 如果数字输入它,例如90亿,有10位数,但是不适合无符号整数?

>请帮助我...编程中的错误=((


一开始尝试编写将它们分成两部分的部分,无需编程。
I am somewhat aware what 10-digit number is. My question was about the choice of -- "int hashfunc(unsigned int ID);" <- this prototype for the function - what if number entered it e.g. nine billion, that has 10 digits, but doesn''t fit into unsigned int?
>help me please..im bad in programming =((

Try, for a beginning, to write the part of dividing them into two parts in a some math notation, without programming.


这篇关于哈希函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆