kmp演算法的php實現,可直接執行

2021-06-05 09:23:50 字數 867 閱讀 7821

<?php	

/*** @todo 改進型kmp演算法,模式串的移動字元陣列

* @param $pattern 模式串

* @param $next 以用模式串的陣列

* @author [email protected]

* **/

function findnextval($pattern,&$next)else

}else

} }/**

* @todo kmp演算法,模式串的移動字元陣列

* @param $pattern 模式串

* @param $next 以用模式串的陣列

* @author [email protected]

* **/

function findnext($pattern,&$next)

if($k<=0)else}}

/*** @todo kmp演算法查詢字串

* @param string @string 目標串

* @param string @pattern 模式串

* @author [email protected]

* **/

function kmp($string,$pattern)

if($j==$pl) return $i-$pl;

$j=$next[$j];

}return -1;

}$pattern='abshhh';

$string='ababababshhabhshhhabshhhabsabsabs';

$s=kmp($string,$pattern);

var_dump($s);

有可直接運營的IPTV OTT系統ma?

iptv 和ott的發展改變了人們 電視節目的習慣,不再被動的接受電視台的節目,而是可以根據自己的喜好選擇喜歡的節目。這也讓電視重新回歸家庭娛樂的中心,現在各大運營商和科技公司在不斷地進入行業,占領市場,iptv或者ott系統只是其中一部分,而布局未來的智慧型家居中占領一定的市場,則是其更高目標。但...

共享記憶體很好的例子, 可直接執行

轉子 include include include include include include include define shm size 1024 用共享記憶體讀寫資料 讀資料到共享記憶體 int shmctl int shmid,int cmd,struct shmid ds buf ...

sqlite3可直接執行的SQl語句

int ret sqlite3 open 628demo.db datb1 開啟628demo.db資料庫,datb1為控制代碼 char str3 1024 char str11 listqwe strcat str3,str11 char str2 id int primary key,name...