📄 myhashfunction.java
字号:
/**
A class for determining the index of a word using unicode
Written by : H Yu
*/
public class MyHashFunction {
/**
*class method returns the index of word w
*@param w word
*/
public static int HashFunction(String w,int d) {
String word = w;
int l = word.length();
int sum=0;
for (int i=0;i<l;i++) {
char ch = word.charAt(i);
int value = Character.getNumericValue(ch);
sum+=value;
}
return(sum%d);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -