nx_boyer_moore.nx
buildroot/runtime/nx_boyer_moore.nx
about
nx_boyer_moore.nx -- Boyer-Moore string search (bad-character heuristic).
Find the first occurrence of `pattern` in `text`, returning the
starting byte index or -1. Uses the bad-character rule (a.k.a.
Horspool-simplified BM): preprocess pattern into a 256-entry skip
table, then scan text right-to-left within each alignment; on
mismatch jump ahead by the table.
genealogy_id: boyer_moore_1977_cacm
lineage_id: single_pattern_exact_string_search
references: Boyer & Moore "A Fast String Searching Algorithm",
CACM 20(10):762-772, October 1977.
license: public_domain (1977 academic publication)
complexity: best O(n/m), avg O(n+m), worst O(n*m) (this BM-bad-char
variant; full Galil/Apostolico-Giancarlo gives O(n+m)).
dependencies 2 imports · 2 importers
imports: nx_syscalls.nxnx_tier.nx
imported by: nx_boyer_moore_test.nxnx_triangulation_sort_string_graph.nx
structs
| none |
consts
| 26 | const NX_BM_BAD_TABLE_LEN: nx_size = 256 |
functions
| 30 | func nx_boyer_moore_build_table(pattern: *u8, m: nx_size, table: *nx_idx) -> nx_int called by 1: nx_boyer_moore_search |
| 52 | func nx_boyer_moore_search(text: *u8, n: nx_size, |