Skip to content

Commit 1b6f7b6

Browse files
committed
finish
1 parent fe90e56 commit 1b6f7b6

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

rust/binary-search/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ pub fn find(array: &[i32], key: i32) -> Option<usize> {
99

1010
while left <= right {
1111
middle = get_middle(left, right);
12-
println!("left: {}, right: {}, middle: {}", left, right, middle);
13-
14-
// Special case
12+
// Special case so that this function doesn't try to search below the index 0.
1513
if middle == 0 {
1614
if array[middle] == key {
1715
return Some(middle)
@@ -20,7 +18,6 @@ pub fn find(array: &[i32], key: i32) -> Option<usize> {
2018
}
2119
}
2220

23-
2421
if array[middle] == key {
2522
return Some(middle)
2623
} else if array[middle] < key {

0 commit comments

Comments
 (0)