mirror of
https://github.com/TheAlgorithms/C
synced 2024-11-24 22:39:52 +03:00
... which is the entire point of sentinel search
This commit is contained in:
parent
654105c8ef
commit
ce3f01f54c
@ -41,11 +41,9 @@ int sentinel_linear_search( int arr[], int len, int key ){
|
||||
int temp = arr[len-1];
|
||||
arr[len-1] = key;
|
||||
|
||||
int i;
|
||||
for(i=0;arr[len-1]!=arr[i];i++){
|
||||
if(i==len-1){
|
||||
break;
|
||||
}
|
||||
int i = 0;
|
||||
while (arr[len-1] != arr[i]) {
|
||||
i++;
|
||||
}
|
||||
|
||||
arr[len-1] = temp;
|
||||
|
Loading…
Reference in New Issue
Block a user