当前位置: 首页 > news >正文

网站名称需要用注册吗高碑店地区网站建设

网站名称需要用注册吗,高碑店地区网站建设,国外空间做网站怎么样,长沙做网站优化Aho-Corasick算法简称AC算法#xff0c;也称为AC自动机(Aho-Corasick)算法#xff0c;1975年产生于贝尔实验室#xff08;The Bell Labs#xff09;#xff0c;是一种用于解决多模式字符串匹配的经典算法之一。 the Bell Lab 本文的运行效果#xff1a; AC算法以模式树…Aho-Corasick算法简称AC算法也称为AC自动机(Aho-Corasick)算法1975年产生于贝尔实验室The Bell Labs是一种用于解决多模式字符串匹配的经典算法之一。 the Bell Lab  本文的运行效果 AC算法以模式树字典树Trie、广度优先策略和KMP模式匹配算法为核心内容。 using System; using System.Collections; using System.Collections.Generic; namespace Legalsoft.Truffer.Algorithm {     /// summary     /// Aho_Corasick 算法     /// /summary     public static partial class PatternSearch     {         private static int MAXS 512;         private static int MAXC 26; private static int[] outt new int[MAXS]; private static int[] f new int[MAXS]; private static int[,] g new int[MAXS, MAXC]; private static int buildMatchingMachine(string[] arr, int k)         {             for (int i 0; i outt.Length; i)             {                 outt[i] 0;             } for (int i 0; i MAXS; i)             {                 for (int j 0; j MAXC; j)                 {                     g[i, j] -1;                 }             } int states 1;             for (int i 0; i k; i)             {                 string word arr[i];                 int currentState 0; for (int j 0; j word.Length; j)                 {                     int ch word[j] - A;                     if (g[currentState, ch] -1)                     {                         g[currentState, ch] states;                     }                     currentState g[currentState, ch];                 } outt[currentState] | (1 i);             } for (int ch 0; ch MAXC; ch)             {                 if (g[0, ch] -1)                 {                     g[0, ch] 0;                 }             } for (int i 0; i MAXC; i)             {                 f[i] 0;             } Queueint q new Queueint();             for (int ch 0; ch MAXC; ch)             {                 if (g[0, ch] ! 0)                 {                     f[g[0, ch]] 0;                     q.Enqueue(g[0, ch]);                 }             } while (q.Count ! 0)             {                 int state q.Peek();                 q.Dequeue(); for (int ch 0; ch MAXC; ch)                 {                     if (g[state, ch] ! -1)                     {                         int failure f[state];                         while (g[failure, ch] -1)                         {                             failure f[failure];                         } failure g[failure, ch];                         f[g[state, ch]] failure; outt[g[state, ch]] | outt[failure]; q.Enqueue(g[state, ch]);                     }                 }             }             return states;         } private static int findNextState(int currentState, char nextInput)         {             int answer currentState;             int ch nextInput - A; while (g[answer, ch] -1)             {                 answer f[answer];             }             return g[answer, ch];         } public static Listint Aho_Corasick_Search(string text, string pattern, int k 1)         {             Listint matchs new Listint(); string[] arr new string[1] { pattern };             buildMatchingMachine(arr, k); int currentState 0; for (int i 0; i text.Length; i)             {                 currentState findNextState(currentState, text[i]); if (outt[currentState] 0)                 {                     continue;                 } for (int j 0; j k; j)                 {                     if ((outt[currentState] (1 j)) 0)                     {                         matchs.Add((i - arr[j].Length 1));                     }                 }             } return matchs;         }     } } POWER BY TRUFFER.CN using System; using System.Collections; using System.Collections.Generic;namespace Legalsoft.Truffer.Algorithm {/// summary/// Aho_Corasick 算法/// /summarypublic static partial class PatternSearch{private static int MAXS 512;private static int MAXC 26;private static int[] outt new int[MAXS];private static int[] f new int[MAXS];private static int[,] g new int[MAXS, MAXC];private static int buildMatchingMachine(string[] arr, int k){for (int i 0; i outt.Length; i){outt[i] 0;}for (int i 0; i MAXS; i){for (int j 0; j MAXC; j){g[i, j] -1;}}int states 1;for (int i 0; i k; i){string word arr[i];int currentState 0;for (int j 0; j word.Length; j){int ch word[j] - A;if (g[currentState, ch] -1){g[currentState, ch] states;}currentState g[currentState, ch];}outt[currentState] | (1 i);}for (int ch 0; ch MAXC; ch){if (g[0, ch] -1){g[0, ch] 0;}}for (int i 0; i MAXC; i){f[i] 0;}Queueint q new Queueint();for (int ch 0; ch MAXC; ch){if (g[0, ch] ! 0){f[g[0, ch]] 0;q.Enqueue(g[0, ch]);}}while (q.Count ! 0){int state q.Peek();q.Dequeue();for (int ch 0; ch MAXC; ch){if (g[state, ch] ! -1){int failure f[state];while (g[failure, ch] -1){failure f[failure];}failure g[failure, ch];f[g[state, ch]] failure;outt[g[state, ch]] | outt[failure];q.Enqueue(g[state, ch]);}}}return states;}private static int findNextState(int currentState, char nextInput){int answer currentState;int ch nextInput - A;while (g[answer, ch] -1){answer f[answer];}return g[answer, ch];}public static Listint Aho_Corasick_Search(string text, string pattern, int k 1){Listint matchs new Listint();string[] arr new string[1] { pattern };buildMatchingMachine(arr, k);int currentState 0;for (int i 0; i text.Length; i){currentState findNextState(currentState, text[i]);if (outt[currentState] 0){continue;}for (int j 0; j k; j){if ((outt[currentState] (1 j)) 0){matchs.Add((i - arr[j].Length 1));}}}return matchs;}} }
http://www.pierceye.com/news/685272/

相关文章:

  • 企业网站内容建设网站开发小程序开发
  • 个人个案网站 类型wordpress群组
  • 微网站建设深圳英文站seo
  • 做网站要钱么网站建设备案多长时间
  • wordpress建站图片效果网站备案前置审批 成都
  • 哈尔滨网站关键词优化手机网站视频播放模板
  • 西安企业做网站贵州毕节建设局网站官网
  • 临沂网站定制室内设计师证书哪个含金量高
  • 国外做化工产品的网站湛江手机网站建设公司
  • 企业网站管理系统如何上传图片湖南网站建设营销推广
  • 网站建设衤金手指花总十五开发平台和开发工具
  • 免费网站安全软件大全游戏网络规划设计师资料及视频教程
  • 怎么把电脑网站做服务器吗做网站的回扣
  • 无锡模板网站设计公司中介网站设计
  • 微网站 手机网站html做一个学校网页
  • 重庆建设工程招标网站电商网站需要哪些备案
  • 有关网页设计与网站建设的文章崇信门户网站留言回复
  • 网站优化有哪些技巧对网站建设的建议
  • wordpress网站管理系统室内设计公司有哪些
  • 域名购买网站个人怎么在百度上打广告
  • 阳江市建设路龙源学校网站物流公司 网站模板
  • 迪庆州建设局网站做营销网站建设挣钱吗
  • 定制网站类似wordpress 简单
  • 数据库对于做网站的重要性商城模板网站模板
  • 梧州高端网站建设服务企业网站建设源码
  • 团购网站优化德州seo排名
  • 网站首页引导页中文简洁网站设计图
  • 娱乐网站排行榜在线商城网站开发代码
  • 手机网站设计通用尺寸上海外贸人才网
  • 智慧团建网站密码格式高端终端网站设计类网站