//霍纳算法的散列函数 function betterHash(string,arr) { const H = 37; var total=0; for (var i = 0; i < string.length; i++) { total += H * total + string.charCodeAt(i); } total =total % this.table.length; if(total<0) { total +=this.table.length-1; } return parseInt(total); }
转载于:https://www.cnblogs.com/Zhengxue/p/6141413.html