Created
June 2, 2017 13:36
-
-
Save x100ex/e773dafe24de60122ef63df3d0069834 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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