File tree Expand file tree Collapse file tree
exercises/practice/binary-search/.docs Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,13 +5,13 @@ Your task is to implement a binary search algorithm.
55A binary search algorithm finds an item in a list by repeatedly splitting it in half, only keeping the half which contains the item we're looking for.
66It allows us to quickly narrow down the possible locations of our item until we find it, or until we've eliminated all possible locations.
77
8- ~~~~ exercism/caution
8+ ``` exercism/caution
99Binary search only works when a list has been sorted.
10- ~~~~
10+ ```
1111
1212The algorithm looks like this:
1313
14- - Find the middle element of a * sorted * list and compare it with the item we're looking for.
14+ - Find the middle element of a _ sorted _ list and compare it with the item we're looking for.
1515- If the middle element is our item, then we're done!
1616- If the middle element is greater than our item, we can eliminate that element and all the elements ** after** it.
1717- If the middle element is less than our item, we can eliminate that element and all the elements ** before** it.
You can’t perform that action at this time.
0 commit comments