Repository navigation
Conversation
- sort/three_way_quicksort: in-place 3-way quicksort on long-array with explicit stack (smaller side first, O(log n) depth); no 3 filterv copies per level. Avg O(n log n) time kept. - sort/three_way_string_quicksort: same in-place 3-way scheme on an object array with depth-tagged stack entries. - math/approximation/mult_weights: index the flat gain vector directly instead of building a T-by-n gain matrix. O(T n) time kept. - combinatorics/stirling_bell: rolling two-row DP (stirling-row) instead of the full (n+1)x(k+1) table with assoc-in. O(n k) time kept. - compiler/attribute_grammar: Horner fold over the bitstring instead of building an n-node map tree plus O(n) synth recursion. O(n) kept. - data_structure/bst_lca: iterative insert via explicit descent path with bottom-up rebuild; duplicates still go right. O(h) per insert kept. - data_structure/red_black_tree: iterative LLRB insert with explicit path and bottom-up balance fixup (duplicates balance on the way up, as before); root recolored black. O(log n) insert kept. AI-Tool: Muse Code (Meta Muse Spark)
Collaborator
Author
|
Superseded by #45 — all four area branches merged into one batch PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #39 — the seven space-complexity items, same time class with
strictly smaller footprints.
Changes
sort/three_way_quicksort/solutionandsort/three_way_string_quicksort/solution: 3filtervcopies/level →in-place 3-way partition on hinted arrays with explicit smaller-first
stack, O(log n) aux (deep-prefix 2k strings: 3.0s → 0.5s).
math/approximation/mult_weights/mult_weights: deleted the T-by-ngain matrix, indexes flat vals directly (2500×2500 outputs identical).
combinatorics/stirling_bell/stirling_bell: full assoc-in table →rolling two-row recurrence.
compiler/attribute_grammar: n-node map tree + synth recursion →Horner fold (3M-bit input: old OOM after 4.7s vs fast 0.4s).
data_structure/bst_lca/...: recursive insert → iterativeexplicit-path descent + bottom-up rebuild (sorted-20k: old
StackOverflow vs correct).
data_structure/red_black_tree/solution: recursive insert-node →iterative insert with explicit path + bottom-up fixup (sorted-100k
identical; delete path intentionally left recursive — insert/fixup
scope only).
Validation
clojure.main, each with anindependent python oracle or identical-failure assertion (incl.
-Xmxheap-limited runs). Pre-existing quirks (quicksort negative parse,
stirling long overflow) preserved byte-identically. Shared GPG cases
unavailable locally — CI covers them.
AI-Tool: Muse Code (Meta Muse Spark)