Skip to content

Commit

Permalink
change in calculating mid (#277)
Browse files Browse the repository at this point in the history
  • Loading branch information
sameer8 authored and thuva4 committed Sep 29, 2018
1 parent 17b39bb commit 6c8b31e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion BinarySearch/C++/BinarySearch - (recursive).cpp
Expand Up @@ -12,7 +12,7 @@ int binarySearch(int low,int high,int key)
{
if(low<=high)
{
int mid = (low + high) / 2;
int mid = low + (high - low ) / 2;

if(a[mid] == key)
return mid // returns the index if key is found.
Expand Down

0 comments on commit 6c8b31e

Please sign in to comment.