摘要: 第一次涉及HASH查找的知识对于字符串的查找有很多前人开发出来的HASH函数,比较常用的好像是ELF 和 BKDR。这道题没想到突破点是在于其nc值,告诉你组成字符串的字母种类。还有用26进制,不管怎么说,只要避免产生冲突,怎么哈希都行。用的是BKDRHash法。#include #include #include #define maxn 20000000#define mm 1000000using namespace std;int hash[maxn]={0};char str[mm];int news[mm]={0};int ans;int n,nc;int BKDRHash(cha 阅读全文
posted @ 2013-08-21 15:07 KRisen 阅读(255) 评论(0) 推荐(0) 编辑