Skip to content

Fix #39 string+geometry items: tries, bisection, band-only - #42

Closed
m-hu wants to merge 1 commit into
masterfrom
fix/39-str-geom-complexity
Closed

m-hu wants to merge 1 commit into
masterfrom
fix/39-str-geom-complexity

Conversation

@m-hu

@m-hu m-hu commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator

Part of #39 — the six string + computational-geometry items, all moved to
the python twins' complexity classes.

Changes

  • string_related/trie/no_prefix_set: sort+segtree → input-order
    persistent trie; O(T log n) → O(T) (600k words: 2.06s → 0.95s).
  • string_related/aho_corasick/determining_dna_health: per-state prefix
    health sums + bisect over ascending :out; O(T·G) → O(T·log G)
    (20k genes/strand: 2.98s → 0.51s, 5.8x).
  • string_related/banded_alignment/banded_alignment: full-table
    enumeration → band-only doseq on transient rows; O(nm) → O(nk)
    (1500² k=5: 3.38s → 0.76s).
  • computational_geometry/dcel_overlay/solution: per-edge/per-vertex
    scans → single-pass transient grouping; O(n⁴) → O(n² log n)
    (V=15028: 8.54s → 0.76s, 11x).
  • computational_geometry/range_tree/solution: take-while rank scans →
    binary search; O(n² log n) → O(n log²n) (n=12000: 5.66s → 0.57s).
  • computational_geometry/segment_stabbing/solution: per-query linear
    rank scan → bisect-right; O(m) → O(log m) per query
    (100k segs/2k queries: 5.35s → 1.24s).

Validation

  • All before/after outputs byte-identical (cmp) on hand-built small +
    adversarial inputs, cross-checked against the python twins (shared GPG
    cases unavailable locally — CI covers them).

AI-Tool: Muse Code (Meta Muse Spark)

no_prefix_set: O(T log n) sort+segtree -> O(T) linear trie, input-order insert.
determining_dna_health: O(T.G) out-scan -> O(T.log G) via per-state prefix
  health sums plus bisection.
banded_alignment: O(nm) full-table scan -> O(nk) band-only enumeration with
  transient rows.
dcel_overlay: O(n^4) per-vertex/per-edge full scans -> single-pass grouping
  of crossings onto edges and half-edges onto tails.
range_tree: O(n^2 log n) take-while scans -> O(n log^2 n) bisection in cascade
  build and query bounds.
segment_stabbing: O(m) per-query rank scan -> O(log m) bisection.

AI-Tool: Muse Code (Meta Muse Spark)
@m-hu

m-hu commented Nov 3, 2026

Copy link
Copy Markdown
Collaborator Author

Superseded by #45 — all four area branches merged into one batch PR.

@m-hu m-hu closed this Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown

🐰 Bencher Report

Projectclojure-code-snippet
Branchfix/39-str-geom-complexity
Testbedubuntu-latest-clojure-rs

⚠️ WARNING: Truncated view!

The full continuous benchmarking report exceeds the maximum length allowed on this platform.

⚠️ WARNING: No Threshold found!

Without a Threshold, no Alerts will ever be generated.

🐰 View full continuous benchmarking report in Bencher

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant