Skip to content

Instantly share code, notes, and snippets.

@x100ex
Created June 2, 2017 13:36
Show Gist options
  • Save x100ex/e773dafe24de60122ef63df3d0069834 to your computer and use it in GitHub Desktop.
Save x100ex/e773dafe24de60122ef63df3d0069834 to your computer and use it in GitHub Desktop.
// https://schani.wordpress.com/2010/04/30/linear-vs-binary-search/
static int
linear_sentinel (const int *arr, int key) {
int i = 0;
for (;;) {
if (arr [i] >= key)
return i;
++i;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment