ocaml: phase 5.1 bs_bounds.ml baseline (lower/upper bound, fingerprint 3211)
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
C++-style lower_bound / upper_bound on a sorted array:
lower_bound — first index >= x (loop uses arr.(mid) < x)
upper_bound — first index > x (loop uses arr.(mid) <= x)
a = [|1; 2; 2; 3; 3; 3; 5; 7; 9|]
upper(x) - lower(x) gives the count of x in a:
cnt3 = 3 cnt2 = 2 cnt5 = 1 cnt9 = 1 cnt4 = 0
fingerprint = 3*1000 + 2*100 + 1*10 + 1 + 0 = 3211
Tests parallel while loops with bisection on ref, mixed strict
and non-strict comparison branches, count-via-subtraction idiom.
176 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-11 Phase 5.1 — bs_bounds.ml baseline (lower_bound /
|
||||
upper_bound binary search; counts of {3,2,5,9,4} in
|
||||
[1;2;2;3;3;3;5;7;9] encoded as 3211). Standard half-open
|
||||
variants: lower_bound returns the first index ≥ x (using `<`),
|
||||
upper_bound returns the first index > x (using `≤`). Counts:
|
||||
3→3, 2→2, 5→1, 9→1, 4→0 → 3*1000+2*100+1*10+1+0 = 3211. Tests
|
||||
parallel while loops with bisection on ref, mixed strict and
|
||||
non-strict comparisons, computing counts via subtraction.
|
||||
176 baseline programs total.
|
||||
- 2026-05-11 Phase 5.1 — distinct_subseq.ml baseline (count
|
||||
distinct subsequences of "rabbbit" that equal "rabbit" = 3).
|
||||
Classic 2D DP: dp[i][j] = dp[i-1][j] + (s[i-1]=t[j-1] ? dp[i-1][j-1]
|
||||
|
||||
Reference in New Issue
Block a user