code wiki / (root) / nx_binary_search.nx

nx_binary_search.nx

buildroot/runtime/nx_binary_search.nx

1756 B48 linesdepth 2pulls 2 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_binary_search.nx -- canonical binary search on a sorted nx_int array. Returns the index of `key` if present, else -1. Uses the overflow-safe midpoint `lo + (hi - lo) / 2` per Bottenbruch 1962. genealogy_id: bottenbruch_1962_correct_binary_search lineage_id: sorted_key_lookup references: Mauchly 1946 (Moore School lectures); Bottenbruch CACM 1962; Knuth TAoCP Vol 3 6.2.1. license: public_domain (pre-1995 classical result) Tier-aware: arr elements + key are nx_int (swappable via nx_tier.nx); indices are nx_idx. No bare i64 anywhere in the API surface.

dependencies 2 imports · 2 importers

nx_syscalls.nx nx_tier.nx nx_binary_search.nx nx_binary_search_test.nx nx_triangulation_battery.nx

imports: nx_syscalls.nxnx_tier.nx

imported by: nx_binary_search_test.nxnx_triangulation_battery.nx

structs

none

consts

none

functions

39func nx_binary_search_lower_bound(arr: *nx_int, n: nx_idx, key: nx_int) -> nx_idx
called by 2: mainmain