Catalog · How the catalog works
SearchBM
Boyer-Moore String Search Algorithm を用いて、任意パターンの配列を高速に検索する方法。
- ★ 5 on GitHub
Anyone may press Interesting, signed in or not. It helps others find this project.
README
SearchBM
Boyer-Moore String Search Algorithm を用いて、任意パターンの配列を高速に検索する方法。

ジェネリクス化TSearchBM<*>されているので、どんな変数型の配列でも扱えます。
var
Ws :TArray<Word>;
S :TSearchBM<Word>;
?? M :Integer;
Ms :TArray<Integer>;
{ 00 01 02 03 04 05 06 07 08 09 }
Ws := [ $79FE, $BA26, $7B88, $BA26, $4F60, $A2A6, $7B15, $395C, $79FE, $7B88,
$3B5B, $B6F6, $4F60, $A2A6, $7B15, $395C, $8F63, $176C, $3E7E, $2E6E ];
{ 10 11 12 13 14 15 16 17 18 19 }
S := TSearchBM<Word>.Create;
S.Pattern := [ $4F60, $A2A6, $7B15, $395C ]; //検索パターンの設定
///// 最短検索
{ 04 =} M := S.Match( Ws );
{ 12 =} M := S.Match( Ws, 10 ); //検索開始位置の指定
{ 04 =} M := S.Match( Ws, 00, 09+1 ); //検索終了位置の指定
///// 複数検索
{ [ 04, 12 ] =} Ms := S.Matches( Ws );
{ [ 12 ] =} Ms := S.Matches( Ws, 10 ); //検索開始位置の指定
{ [ 04 ] =} Ms := S.Matches( Ws, 00, 09+1 ); //検索終了位置の指定
S.Free;- Boyer-Moore algorithm
- 「データ構造」第13回 資料(Jul. 10, 2002, 奥乃)
- Algorytm BM (Boyer-Moore'a) - Implementacja w Delphi/Pascal - Algorytmy i Struktury Danych
- Computer Algorithms: Boyer-Moore String Searching
- Boyer-Moore algorithm - コードの恵み
http://img.en25.com/EloquaImages/clients/Embarcadero/%7B063f1eec-64a6-4c19-840f-9b59d407c914%7D_dx-starter-bn159.png

