Skip to content

Commit

Permalink
optimize binary_search
Browse files Browse the repository at this point in the history
  • Loading branch information
Servon committed Dec 31, 2020
1 parent 1b7d88a commit e2bcfd8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions zoopt/algos/opt_algorithms/racos/sracos.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ def binary_search(self, iset, x, begin, end):
return end + 1
if end == begin + 1:
return end
mid = (begin + end) // 2
mid = begin + (end - begin) // 2
if x_value <= iset[mid].get_value():
return self.binary_search(iset, x, begin, mid)
else:
Expand Down Expand Up @@ -369,7 +369,7 @@ def binary_search(self, iset, x, begin, end):
return end + 1
if end == begin + 1:
return end
mid = (begin + end) // 2
mid = begin + (end - begin) // 2
if x_value <= iset[mid].get_value():
return self.binary_search(iset, x, begin, mid)
else:
Expand Down

0 comments on commit e2bcfd8

Please sign in to comment.