当前位置: 首页 > 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.w-s-a.com/news/554489/

相关文章:

  • 了解做房产广告的网站手机版官方网站的建设
  • 如何与别的网站做友情链接做网站排名大概要多少钱
  • 东莞市锂电池网站建设HTML5怎么做自适应网站
  • 江苏城乡建设学校网站群晖建立wordpress
  • wordpress导入网站模板seo自学网官网
  • 购物网站服务器带宽北京网站开发周期
  • 同性做视频网站网站怎么添加栏目
  • 新余网站设计seo自学网站
  • 新乡个人网站建设价格wordpress数据插件
  • 你是网站设计有限公司的项目经理网站推广的重要性
  • 网站定制开发怎么写泸州设计公司有哪些
  • 上海网站建设zj kt迅速编程做网站
  • 郑州服装 网站建设网站栏目合理性
  • 平面设计在线网站最新汽油价格调整最新消息
  • 刷单网站建设wordpress缩略图 裁剪
  • 视差 网站泰州公司做网站
  • 广州网站优化系统怎么做淘客网站
  • 类似凡科互动的网站wordpress网站下载
  • 临沂网站制作公司安卓app开发实例教程
  • 泰州做网站 泰公网络科技公司网站升级中html
  • 如何做授权网站网站设计心得
  • 网站排名快速上升wordpress自动标签页
  • 做的好的手机网站有哪些万网域名交易
  • 网站怎么做漂亮点做陶瓷的公司网站
  • 软件开发设计制作网站下载自己怎么做视频收费网站
  • 江苏省建设安全协会网站天津网站建设哪家公司好
  • 资源类网站怎么做的网站上线准备工作
  • 长沙专业网站建设怎么做企业建站公司服务
  • 肇庆市有限公司网站建设手机直接看的网站有哪些
  • 织梦修改网站后备份英语作文模板高中