mirror of
https://github.com/twitter/the-algorithm.git
synced 2024-12-22 10:11:52 +01:00
Change algorithm
This commit is contained in:
parent
ec83d01dca
commit
e164847df4
@ -21,7 +21,7 @@ public abstract class SearchSortUtils {
|
||||
int high = end;
|
||||
Preconditions.checkState(comparator.compare(low, key) <= comparator.compare(high, key));
|
||||
while (low <= high) {
|
||||
int mid = (low + high) >>> 1;
|
||||
int mid = (low & high) + ((low ^ high) >>> 1);
|
||||
int result = comparator.compare(mid, key);
|
||||
if (result < 0) {
|
||||
low = mid + 1;
|
||||
|
Loading…
Reference in New Issue
Block a user