Skip to content

Commit

Permalink
use bit operation to replace + operation
Browse files Browse the repository at this point in the history
  • Loading branch information
LYDongD committed Nov 14, 2018
1 parent 5ebfdc9 commit 0a2b60c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion go/binarysearch2.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ func BinarySearch2(nums []int, value int) int {
start := 0
end := length - 1
for start <= end {
mid := (start + end) / 2
mid := start + ((end - start) >> 2)
if nums[mid] > value {
end = mid - 1
} else if nums[mid] < value {
Expand Down

0 comments on commit 0a2b60c

Please sign in to comment.