文字列アルゎリズムAdvanced

Boyer-Moore文字列マッチング

悪い文字ヒュヌリスティックず良い接尟蟞ヒュヌリスティックを䜿甚した効率的な文字列怜玢アルゎリズムです。パタヌンを右から巊に比范し、䞍䞀臎時に倧きなゞャンプを可胜にしたす。実際にはサブリニア時間を達成し、最速の文字列マッチングアルゎリズムの1぀です。

#string#pattern-matching#heuristic#text-search

Complexity Analysis

Time (Average)

O(n)

Expected case performance

Space

O(m + σ)

Memory requirements

Time (Best)

O(n/m)

Best case performance

Time (Worst)

O(n × m)

Worst case performance

📚 CLRS Reference

Introduction to Algorithms•Chapter 32•Section 32.5

Step: 1 / 0
500ms
SlowFast
Keyboard Shortcuts
Space Play/Pause← → StepR Reset1-4 Speed

Real-time Statistics

Algorithm Performance Metrics

Progress0%
Comparisons
0
Swaps
0
Array Accesses
0
Steps
1/ 0

Algorithm Visualization

Step 1 of 0

Initialize array to begin

Default
Comparing
Swapped
Sorted

Code Execution

Currently executing
Previously executed

Implementation

Boyer-Moore String Matching - Algorithm Vision | Algorithm Vision