ocaml: phase 5.1 bs_rotated.ml baseline (rotated array search, encoded -66)
Some checks failed
Test, Build, and Deploy / test-build-deploy (push) Failing after 22s

Binary search in a rotated sorted array. Standard sorted-half
test at each step:

  if arr.(lo) <= arr.(mid) then
    left half [lo, mid] is sorted -> check whether target is in it
  else
    right half [mid, hi] is sorted -> check whether target is in it

For [4; 5; 6; 7; 0; 1; 2]:
  search 0 -> index 4
  search 7 -> index 3
  search 3 -> -1 (absent)

Encoded fingerprint: 4 + 3*10 + (-1)*100 = -66.

First baseline returning a negative top-level value; the runner
uses literal grep -qF so leading minus parses fine.

196 baseline programs total.
This commit is contained in:
2026-05-11 04:44:37 +00:00
parent 67ece98ba1
commit b240408a4c
3 changed files with 36 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 — bs_rotated.ml baseline (binary search in
rotated sorted array; encoded result -66). For [4;5;6;7;0;1;2]:
- search 0 → index 4
- search 7 → index 3
- search 3 → 1 (not present)
Encoded: 4 + 3*10 + (-1)*100 = -66. Each step decides which half
is sorted by comparing arr[lo] vs arr[mid], then checks whether
the target falls in that sorted half. First baseline with a
negative top-level result; test runner uses literal `grep -qF`
so the leading minus is fine. 196 baseline programs total.
- 2026-05-11 Phase 5.1 — task_scheduler.ml baseline (task cooldown
formula, "AAABBC" with n=2 → 7 intervals). Counts each letter,
finds max frequency `m` and the number of letters that hit that