| 123456789 |
- <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 820 270" role="img" aria-labelledby="title desc">
- <title id="title">KMP 中失配后保留的重叠</title><desc id="desc">模式 ABABAC 匹配 ABABA 后失配,ABA 同时是前缀和后缀,应被保留。</desc>
- <style>text{font-family:ui-monospace,monospace;fill:#172033}.hot{fill:#fde68a}.cold{fill:#f8fafc}.box{stroke:#64748b;stroke-width:2}.note{font-family:system-ui,sans-serif;font-size:19px;fill:#172033}.label{font-size:25px;font-weight:700}</style>
- <text x="28" y="31" class="note">已经匹配 ABABA,下一位失配;黄色 ABA 仍是下一轮可能的开头。</text>
- <text class="label" x="38" y="101">文本</text><text class="label" x="38" y="177">模式</text>
- <g transform="translate(145 69)"><rect class="hot box" x="0" y="0" width="65" height="48"/><rect class="hot box" x="65" y="0" width="65" height="48"/><rect class="hot box" x="130" y="0" width="65" height="48"/><rect class="hot box" x="195" y="0" width="65" height="48"/><rect class="hot box" x="260" y="0" width="65" height="48"/><rect class="cold box" x="325" y="0" width="65" height="48"/><text x="21" y="33">A</text><text x="86" y="33">B</text><text x="151" y="33">A</text><text x="216" y="33">B</text><text x="281" y="33">A</text><text x="346" y="33">B</text></g>
- <g transform="translate(145 145)"><rect class="hot box" x="0" y="0" width="65" height="48"/><rect class="hot box" x="65" y="0" width="65" height="48"/><rect class="hot box" x="130" y="0" width="65" height="48"/><rect class="hot box" x="195" y="0" width="65" height="48"/><rect class="hot box" x="260" y="0" width="65" height="48"/><rect class="cold box" x="325" y="0" width="65" height="48"/><text x="21" y="33">A</text><text x="86" y="33">B</text><text x="151" y="33">A</text><text x="216" y="33">B</text><text x="281" y="33">A</text><text x="346" y="33" fill="#dc2626">C</text></g>
- <path d="M150 218 C190 255 300 255 340 218" stroke="#d97706" stroke-width="4" fill="none"/><text x="205" y="266" class="note">后缀 ABA = 前缀 ABA</text>
- </svg>
|