Server string matching algorithm

xiaoxiao2021-03-06  37

kmp algorithm: (java version) class SuiteString {/ ** * To get the NEXT array coordinate the subString * @param sub the subString * @return the NEXT array * * / private static int [] getNext (String sub) {final. INT SUBLENGTH = Sub.Length (); // length of sub string int [] next = new int [SubLength 1]; int i = 1, j = 0; // i: sub's index; J: the value of next [i] Next [0] = 0; Next [1] = 0; / * in Fact, the Operation is end of 'i == SubLength 1' * / while (i

转载请注明原文地址:https://www.9cbs.com/read-56026.html

New Post(0)