mirror of
https://github.com/RolandWH/ceesort.git
synced 2025-03-14 17:01:36 +00:00
fix infinite loop for some numbers in binary search
This commit is contained in:
parent
ecdcdc2821
commit
e260cf38dc
@ -23,6 +23,7 @@ int bsrch(int target, int* arr, size_t n)
|
||||
{
|
||||
if (arr[mid] == target) found = true;
|
||||
if (start == end && !found) return -1;
|
||||
if (mid == end && !found) return -1;
|
||||
else if (arr[mid] < target)
|
||||
{
|
||||
start = mid + 1;
|
||||
|
Loading…
x
Reference in New Issue
Block a user