ocaml: phase 5.1 partition_count.ml baseline (p(15) = 176)
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
Counts integer partitions via classic DP:
let partition_count n =
let dp = Array.make (n + 1) 0 in
dp.(0) <- 1;
for k = 1 to n do
for i = k to n do
dp.(i) <- dp.(i) + dp.(i - k)
done
done;
dp.(n)
partition_count 15 = 176
Tests Array.make, .(i)<-/.(i) array access, nested for-loops, refs.
135 baseline programs total.
This commit is contained in:
@@ -407,6 +407,12 @@ _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 — partition_count.ml baseline (number of
|
||||
integer partitions of 15 = 176). Classic DP: dp[0] = 1; for each
|
||||
k from 1..n, for each i from k..n, dp[i] += dp[i - k]. O(n²) time,
|
||||
O(n) space. p(15) = 176 partitions of 15. Tests Array.make, array
|
||||
set/get with `.(i)<-` / `.(i)`, nested for-loops, ref deref.
|
||||
135 baseline programs total.
|
||||
- 2026-05-10 Phase 5.1 — pythagorean.ml baseline (count primitive
|
||||
Pythagorean triples with hypotenuse ≤ 100 = 16). Uses Euclid's
|
||||
formula: for coprime m > k of opposite parity, the triple
|
||||
|
||||
Reference in New Issue
Block a user