nx_binary_search.nx
buildroot/runtime/nx_binary_search.nx
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
imports: nx_syscalls.nxnx_tier.nx
imported by: nx_binary_search_test.nxnx_triangulation_battery.nx
structs
| none |
consts
| none |
functions
| 25 | func nx_binary_search(arr: *nx_int, n: nx_idx, key: nx_int) -> nx_idx called by 1: main |
| 39 | func nx_binary_search_lower_bound(arr: *nx_int, n: nx_idx, key: nx_int) -> nx_idx |