ocaml: phase 5.1 palindrome_part.ml baseline (min cuts "aabba" = 1)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 24s

Two-phase palindrome-partition DP for the minimum-cuts variant:

  Phase 1: is_pal[i][j] palindrome table via length-major fill
           (single chars, then pairs, then expand inward).

  Phase 2: cuts[i] = 0 if s[0..i] is itself a palindrome,
                  = min over j of (cuts[j-1] + 1)
                    where s[j..i] is a palindrome.

  min_cut "aabba" = 1   ("a" | "abba")

Tests two sequential 2D DPs sharing the same is_pal matrix,
inline begin/end branches inside the length-major fill, mixed
bool and int 2D arrays.

181 baseline programs total.
This commit is contained in:
2026-05-11 02:14:44 +00:00
parent 6d7df11224
commit 2726ed9b8a
3 changed files with 46 additions and 0 deletions

View File

@@ -407,6 +407,16 @@ _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-11 Phase 5.1 — palindrome_part.ml baseline (minimum
palindrome-partition cuts in "aabba" = 1). Two-phase DP:
1) `is_pal.(i).(j)` table via length-major iteration.
2) `cuts.(i)` = min cuts for prefix s[0..i]; if s[0..i] itself
is a palindrome, 0; else min over j of (cuts.(j-1) + 1)
where s[j..i] is a palindrome.
For "aabba" the optimal partition is "a" | "abba" = 1 cut.
Tests sequential 2D DP passes sharing the same `is_pal` matrix,
inline `if/else begin/end` blocks under length-major fill, mixed
bool and int 2D arrays. 181 baseline programs total.
- 2026-05-11 Phase 5.1 — island_count.ml baseline (count 4-connected
components of 1-cells in a 6×7 grid = 5). DFS flood from every
unvisited 1-cell. Counted islands: