ocaml: phase 5.1 rolling_hash.ml baseline (Rabin-Karp, 6 "abc" matches)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 22s
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 22s
Polynomial rolling hash mod 1000003 with base 257: - precompute base^(m-1) - slide window updating hash in O(1) per step - verify hash match with O(m) memcmp to skip false positives rolling_match "abcabcabcabcabcabc" "abc" = 6 Six non-overlapping copies of "abc" at positions 0,3,6,9,12,15. Tests `for _ = 0 to m - 2 do … done` unused loop variable (uses underscore wildcard pattern), Char.code arithmetic, mod arithmetic with intermediate negative subtractions, complex nested if/begin branching with inner break-via-flag. 151 baseline programs total.
This commit is contained in:
@@ -407,6 +407,15 @@ _Newest first._
|
||||
binary search tree (`type 'a tree = Leaf | Node of 'a * 'a tree *
|
||||
'a tree`) with insert + in-order traversal. Tests parametric ADT,
|
||||
recursive match, List.append, List.fold_left.
|
||||
- 2026-05-10 Phase 5.1 — rolling_hash.ml baseline (Rabin-Karp
|
||||
rolling hash for substring matching, count "abc" in
|
||||
"abcabcabcabcabcabc" = 6). Polynomial hash mod 1000003 with
|
||||
base 257; precompute base^(m-1), then slide window updating
|
||||
hash in O(1) per step. Verify hash matches with O(m) memcmp to
|
||||
avoid false positives. Tests `for _ = 0 to m - 2 do … done`
|
||||
unused loop variable, char-code arithmetic, mod under negative
|
||||
intermediate, complex nested if/begin/end branching.
|
||||
151 baseline programs total.
|
||||
- 2026-05-10 Phase 5.1 — huffman.ml baseline (Huffman tree weighted
|
||||
path length on letters {(5,a) (9,b) (12,c) (13,d) (16,e) (45,f)}
|
||||
= 224). Builds optimal prefix code by repeatedly merging the two
|
||||
|
||||
Reference in New Issue
Block a user