Skip to content

Conversation

@pearmini
Copy link
Collaborator

@pearmini pearmini commented Oct 5, 2025

Related: #143

//➜ lo: 0,2,3 //➜ hi: 3,3,3 //➜ mi: 1,2,3 //➜ val: "b","c","d" binarySearch('g', ["a", "b", "c", "d"], echo); function binarySearch(key, array, echo=() => {}) { let lo = 0; let hi = array.length - 1; while (lo <= hi) { const mi = Math.floor((lo + hi) / 2); const val = array[mi]; echo(lo, {key: "lo"}); echo(hi, {key: "hi"}); echo(mi, {key: "mi"}); echo(val, {key: "val"}); if (val < key) lo = mi + 1; else if (val > key) hi = mi - 1; else return mi; } return -1; }
@pearmini pearmini marked this pull request as draft October 5, 2025 12:40
@cloudflare-workers-and-pages
Copy link

Deploying recho with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3cea08e
Status: ✅  Deploy successful!
Preview URL: https://4a9051f2.recho.pages.dev
Branch Preview URL: https://echo-key.recho.pages.dev

View logs

@pearmini pearmini force-pushed the main branch 8 times, most recently from 3f305c5 to 9edb43c Compare October 6, 2025 13:46
@pearmini pearmini force-pushed the main branch 3 times, most recently from 5c9c667 to 5dbb7e0 Compare October 20, 2025 17:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants