ocaml: phase 5.1 manacher.ml baseline (longest palindrome "babadaba" = 7)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 25s

Manacher's algorithm: insert # separators (length 2n+1) to unify
odd/even cases, then maintain palindrome radii p[] alongside a
running (center, right) pair to skip work via mirror reflection.
Linear time.

  manacher "babadaba" = 7   (* witness: "abadaba", positions 1..7 *)

Note: requires parenthesizing the if-expression on the rhs of <-:

  p.(i) <- (if pm < v then pm else v)

Real OCaml parses bare `if` at <-rhs since the rhs is at expr
level; our parser places <-rhs at binop level which doesn't include
`if` / `match` / `let`. Workaround until we relax the binop
RHS grammar.

149 baseline programs total.
This commit is contained in:
2026-05-10 05:58:05 +00:00
parent 526ffbb5f0
commit cccef832d9
3 changed files with 43 additions and 0 deletions

View File

@@ -87,6 +87,7 @@
"lambda_calc.ml": 7,
"lcs.ml": 4,
"majority_vote.ml": 4,
"manacher.ml": 7,
"levenshtein.ml": 11,
"memo_fib.ml": 75025,
"mortgage.ml": 1073,