Skip to content

Commit 68a20e3

Browse files
whiteeagle44egonSchiele
authored andcommitted
Update 01_binary_search.c (egonSchiele#74)
1 parent 522efcb commit 68a20e3

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

01_introduction_to_algorithms/c/01_binary_search.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#include <stdio.h>
2-
#include <math.h>
32

43
int binarySearch(int[], int, int);
54

@@ -19,7 +18,7 @@ int binarySearch(int list[], int item, int len)
1918
int high = len;
2019
while (low <= high)
2120
{
22-
int mid = floor((low + high) / 2); //math.h floor
21+
int mid = (low + high)/2;
2322
int guess = list[mid];
2423

2524
if (guess == item)
@@ -35,5 +34,5 @@ int binarySearch(int list[], int item, int len)
3534
low = mid + 1;
3635
}
3736
}
38-
return -1; //number not find
37+
return -1; //number not found
3938
}

0 commit comments

Comments
 (0)