code wiki / (root) / nx_sort_pairs_candidate_t365.nx

nx_sort_pairs_candidate_t365.nx

buildroot/runtime/nx_sort_pairs_candidate_t365.nx

3810 B102 linesdepth 5pulls 5 transitivereach 0 importersview sourcekind orphan library
docsdependenciesstructsconstsfunctions

about

nx_sort.nx -- sorting algorithms. Canonical: this is the substrate-wide canonical sort library per [[feedback-no-tool-proliferation-bit-level]]. Provides: - nx_sort_insertion: O(n^2) cache-friendly bubble-style; substrate canonical for small arrays. - nx_sort_heap: O(n log n) in-place; substrate canonical for larger arrays. - nx_sort_is_sorted: invariant check. Other primitives needing a sort MUST `import "nx_sort.nx"` and compose; re-implementing inline is refused per the cardinal. For quicksort variants see nx_quicksort.nx (separate canonical). - Insertion sort: O(n^2) but cache-friendly, good for small arrays. - Heap sort: O(n log n), in-place, uses sketch_min_heap. Pure i64 ascending order. genealogy_id: williams_1964_heap_sort + insertion_sort_folklore lineage_id: in_place_comparison_sort

dependencies 2 imports · 0 importers

syscalls.nx sketch_min_heap.nx nx_sort_pairs_candidate_t365.n

imports: syscalls.nxsketch_min_heap.nx

imported by: nobody (leaf or entry point)

structs

none

consts

none

functions

45func nx_sort_insertion(arr: *i64, n: i64) -> i64
67func nx_sort_heap(arr: *i64, n: i64) -> i64
88func nx_sort_is_sorted(arr: *i64, n: i64) -> i64
99func nx_sort_pairs_first(pairs:*i64,n:i64)->i64