# Binary search algorithm

(Redirected from Binary chop)
Class Visualization of the binary search algorithm where 7 is the target value. Search algorithm Array O(log n) O(1) O(log n) O(1)

In computer science, binary search, also known as half-interval search,[1] logarithmic search,[2] or binary chop,[3] is a search algorithm that finds the position of a target value within a sorted array.[4][5] Binary search compares the target value to the middle element of the array; if they are unequal, the half in which the target cannot lie is eliminated and the search continues on the remaining half until it is successful. If the search ends with the remaining half being empty, the target is not in the array.

Binary search runs in at worst logarithmic time, making O(log n) comparisons, where n is the number of elements in the array, the O is Big O notation, and log is the logarithm. Binary search takes constant (O(1)) space, meaning that the space taken by the algorithm is the same for any number of elements in the array.[6] Although specialized data structures designed for fast searching—such as hash tables—can be searched more efficiently, binary search applies to a wider range of problems.

Although the idea is simple, implementing binary search correctly requires attention to some subtleties about its exit conditions and midpoint calculation.

There are numerous variations of binary search. In particular, fractional cascading speeds up binary searches for the same value in multiple arrays, efficiently solving a series of search problems in computational geometry and numerous other fields. Exponential search extends binary search to unbounded lists. The binary search tree and B-tree data structures are based on binary search.

## Algorithm

Binary search works on sorted arrays. Binary search begins by comparing the middle element of the array with the target value. If the target value matches the middle element, its position in the array is returned. If the target value is less than or greater than the middle element, the search continues in the lower or upper half of the array, respectively, eliminating the other half from consideration.[7]

### Procedure

Given an array A of n elements with values or records A0, A1, ..., An−1, sorted such that A0A1 ≤ ... ≤ An−1, and target value T, the following subroutine uses binary search to find the index of T in A.[7]

1. Set L to 0 and R to n − 1.
2. If L > R, the search terminates as unsuccessful.
3. Set m (the position of the middle element) to the floor (the largest previous integer) of (L + R) / 2.
4. If Am < T, set L to m + 1 and go to step 2.
5. If Am > T, set R to m − 1 and go to step 2.
6. Now Am = T, the search is done; return m.

This iterative procedure keeps track of the search boundaries with two variables. Some implementations may check whether the middle element is equal to the target at the end of the procedure. This results in a faster comparison loop, but requires one more iteration on average.[8]

### Approximate matches

The above procedure only performs exact matches, finding the position of a target value. However, due to the ordered nature of sorted arrays, it is trivial to extend binary search to perform approximate matches. For example, binary search can be used to compute, for a given value, its rank (the number of smaller elements), predecessor (next-smallest element), successor (next-largest element), and nearest neighbor. Range queries seeking the number of elements between two values can be performed with two rank queries.[9]

• Rank queries can be performed using a modified version of binary search. By returning m on a successful search, and L on an unsuccessful search, the number of elements less than the target value is returned instead.[9]
• Predecessor and successor queries can be performed with rank queries. Once the rank of the target value is known, its predecessor is the element at the position given by its rank (as it is the largest element that is smaller than the target value). Its successor is the element after it (if it is present in the array) or at the next position after the predecessor (otherwise).[10] The nearest neighbor of the target value is either its predecessor or successor, whichever is closer.
• Range queries are also straightforward. Once the ranks of the two values are known, the number of elements greater than or equal to the first value and less than the second is the difference of the two ranks. This count can be adjusted up or down by one according to whether the endpoints of the range should be considered to be part of the range and whether the array contains keys matching those endpoints.[11]

## Performance

A tree representing binary search. The array being searched here is [20, 30, 40, 50, 90, 100], and the target value is 40.

The performance of binary search can be analyzed by reducing the procedure to a binary comparison tree, where the root node is the middle element of the array; the middle element of the lower half is left of the root and the middle element of the upper half is right of the root. The rest of the tree is built in a similar fashion. This model represents binary search; starting from the root node, the left or right subtrees are traversed depending on whether the target value is less or more than the node under consideration, representing the successive elimination of elements.[6][12]

The worst case is ${\textstyle \lfloor \log _{2}n+1\rfloor }$ iterations of the comparison loop, where the ${\textstyle \lfloor \rfloor }$ notation denotes the floor function that rounds its argument to the next-smallest integer and ${\textstyle \log _{2}}$ is the binary logarithm. The worst case is reached when the search reaches the deepest level of the tree, equivalent to a binary search that has reduced to one element and, in each iteration, always eliminates the smaller subarray out of the two if they are not of equal size.[a][12]

On average, assuming that each element is equally likely to be searched, the procedure will most likely find the target value the second-deepest level of the tree. This is equivalent to a binary search that completes one iteration before the worst case, reached after ${\textstyle \log _{2}n-1}$ iterations. However, the tree may be unbalanced, with the deepest level partially filled, and equivalently, the array may not be divided perfectly by the search in some iterations, half of the time resulting in the smaller subarray being eliminated. The actual number of average iterations is slightly higher, at ${\textstyle \log _{2}n-{\frac {n-\log _{2}n-1}{n}}}$ iterations.[6] In the best case, where target value is the middle element of the array, its position is returned after one iteration.[13] In terms of iterations, no search algorithm that works only by comparing elements can exhibit better average and worst-case performance than binary search.[12]

Each iteration of the binary search procedure defined above makes one or two comparisons, checking if the middle element is equal to the target in each iteration. Again assuming that each element is equally likely to be searched, each iteration makes 1.5 comparisons on average. A variation of the algorithm checks whether the middle element is equal to the target at the end of the search, eliminating on average half a comparison from each iteration. This slightly cuts the time taken per iteration on most computers, while guaranteeing that the search takes the maximum number of iterations, on average adding one iteration to the search. Because the comparison loop is performed only ${\textstyle \lfloor \log _{2}n+1\rfloor }$ times in the worst case, for all but enormous ${\textstyle n}$, the slight increase in comparison loop efficiency does not compensate for the extra iteration. Knuth 1998 gives a value of ${\textstyle 2^{66}}$ (more than 73 quintillion)[14] elements for this variation to be faster.[b][15][16]

Fractional cascading can be used to speed up searches of the same value in multiple arrays. Where ${\textstyle k}$ is the number of arrays, searching each array for the target value takes ${\textstyle O(k\log n)}$ time; fractional cascading reduces this to ${\textstyle O(k+\log n)}$.[17]

## Binary search versus other schemes

Sorted arrays with binary search are a very inefficient solution when insertion and deletion operations are interleaved with retrieval, taking ${\textstyle O(n)}$ time for each such operation, and complicating memory use.[18] Other data structures support much more efficient insertion and deletion, and also fast exact matching. However, binary search applies to a wide range of search problems, usually solving them in ${\textstyle O(\log n)}$ time regardless of the type or structure of the values themselves.

### Hashing

For implementing associative arrays, hash tables, a data structure that maps keys to records using a hash function, are generally faster than binary search on a sorted array of records;[19] most implementations require only amortized constant time on average.[c][21] However, hashing is not useful for approximate matches, such as computing the next-smallest, next-largest, and nearest key, as the only information given on a failed search is that the target is not present in any record.[22] Binary search is ideal for such matches, performing them in logarithmic time. In addition, all operations possible on a sorted array can be performed—such as finding the smallest and largest key and performing range searches.[23]

### Trees

Binary search trees are searched using an algorithm similar to binary search.

A binary search tree is a binary tree data structure that works based on the principle of binary search. The records of the tree are arranged in sorted order, and each record in the tree can be searched using an algorithm similar to binary search, taking on average logarithmic time. Insertion and deletion also require on average logarithmic time in binary search trees. This can faster than the linear time insertion and deletion of sorted arrays, and binary trees retain the ability to perform all the operations possible on a sorted array, including range and approximate queries.[24]

However, binary search is usually more efficient for searching as binary search trees will most likely be imperfectly balanced, resulting in slightly worse performance than binary search. This applies even to balanced binary search trees, binary search trees that balance their own nodes—as they rarely produce optimally-balanced trees—but to a lesser extent. Although unlikely, the tree may be severely imbalanced with few internal nodes with two children, resulting in the average and worst-case search time approaching ${\textstyle n}$ comparisons.[d] Binary search trees take more space than sorted arrays.[26]

Binary search trees lend themselves to fast searching in external memory stored in hard disks, as binary search trees can effectively be structured in filesystems. The B-tree generalizes this method of tree organization; B-trees are frequently used to organize long-term storage such as databases and filesystems.[27][28]

### Linear search

Linear search is a simple search algorithm that checks every record until it finds the target value. Linear search can be done on a linked list, which allows for faster insertion and deletion than an array. Binary search is faster than linear search for sorted arrays except if the array is short.[e][30] If the array must first be sorted, that cost must be amortized over any searches. Sorting the array also enables efficient approximate matches and other operations.[31]

### Mixed approaches

The Judy array uses a combination of approaches to provide a highly efficient solution.

### Set membership algorithms

A related problem to search is set membership. Any algorithm that does lookup, like binary search, can also be used for set membership. There are other algorithms that are more specifically suited for set membership. A bit array is the simplest, useful when the range of keys is limited; it is very fast, requiring only ${\textstyle O(1)}$ time.[32] The Judy1 type of Judy array handles 64-bit keys efficiently.

For approximate results, Bloom filters, another probabilistic data structure based on hashing, store a set of keys by encoding the keys using a bit array and multiple hash functions. Bloom filters are much more space-efficient than bitarrays in most cases and not much slower: with ${\textstyle k}$ hash functions, membership queries require only ${\textstyle O(k)}$ time. However, Bloom filters suffer from false positives.[f][g][34]

### Other data structures

There exist data structures that may improve on binary search in some cases for both searching and other operations available for sorted arrays. For example, searches, approximate matches, and the operations available to sorted arrays can be performed more efficiently than binary search on specialized data structures such as van Emde Boas trees, fusion trees, tries, and bit arrays. However, while these operations can always be done at least efficiently on a sorted array regardless of the keys, such data structures are usually only faster because they exploit the properties of keys with a certain attribute (usually keys that are small integers), and thus will be time or space consuming for keys that lack that attribute.[23]

## Variations

### Uniform binary search

Uniform binary search stores, instead of the lower and upper bounds, the index of the middle element and the change in the middle element from the current iteration to the next iteration. Each step reduces the change by about half. For example, if the array to be searched was [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], the middle element would be 5. Uniform binary search works on the basis that the difference between the index of middle element of the array and the left and right subarrays is the same. In this case, the middle element of the left subarray ([1, 2, 3, 4]) is 2 and the middle element of the right subarray ([6, 7, 8, 9, 10]) is 8. Uniform binary search would store the value of 3 as both indices differ from 5 by this same amount.[35] To reduce the search space, the algorithm either adds or subtracts this change from the middle element. The main advantage of uniform binary search is that the procedure can store a table of the differences between indices for each iteration of the procedure, which may improve the algorithm's performance on some systems.[36]

### Fibonacci search

Fibonacci search on the function ${\textstyle f(x)=\sin {}((x+{\frac {1}{10}})\pi )}$ on the unit interval ${\textstyle {[0,1]}}$. The algorithm finds an interval containing the maximum of ${\textstyle f}$ with a length less than or equal to ${\textstyle {\frac {1}{10}}}$ in the above example. In three iterations, it returns the interval ${\textstyle {\left[{\frac {5}{13}},{\frac {6}{13}}\right]}}$, which is of length ${\textstyle {\frac {1}{13}}}$.

Fibonacci search is a method similar to binary search that successively shortens the interval in which the maximum of a unimodal function lies. Given a finite interval, a unimodal function, and the maximum length of the resulting interval, Fibonacci search finds a Fibonacci number such that if the interval is divided equally into that many subintervals, the subintervals would be shorter than the maximum length. After dividing the interval, it eliminates the subintervals in which the maximum cannot lie until one or more contiguous subintervals remain.[37][38]

### Exponential search

Exponential search extends binary search to unbounded lists. It starts by finding the first element with an index that is both a power of two and greater than the target value. Afterwards, it sets that index as the upper bound, and switches to binary search. A search takes ${\textstyle \lfloor \log _{2}x+1\rfloor }$ iterations of the exponential search and at most ${\textstyle \lfloor \log _{2}x\rfloor }$ iterations of the binary search, where ${\textstyle x}$ is the position of the target value. Exponential search works on bounded lists, but becomes an improvement over binary search only if the target value lies near beginning of the array.[39]

### Interpolation search

Instead of calculating the midpoint, interpolation search estimates the position of the target value, taking into account the lowest and highest elements in the array as well as length of the array. This is only possible if the array elements are numbers. It works on the basis that the midpoint is not the best guess in many cases. For example, if the target value is close to the highest element in the array, it is likely to be located near the end of the array.[40] When the distribution of the array elements is uniform or near uniform, it makes ${\textstyle O(\log \log n)}$ comparisons.[40][41][42]

In practice, interpolation search is slower than binary search for small arrays, as interpolation search requires extra computation. Although its time complexity grows more slowly than binary search, this only compensates for the extra computation for large arrays.[40]

Fractional cascading is a technique that speeds up binary searches for the same element for both exact and approximate matching in "catalogs" (arrays of sorted elements) associated with vertices in graphs. Searching each catalog separately requires ${\textstyle O(k\log n)}$ time, where ${\textstyle k}$ is the number of catalogs. Fractional cascading reduces this to ${\textstyle O(k+\log n)}$ by storing specific information in each catalog about other catalogs.[17]

Fractional cascading was originally developed to efficiently solve various computational geometry problems, but it also has been applied elsewhere, in domains such as data mining and Internet Protocol routing.[17]

### Noisy binary search

Noisy binary search algorithms solve the case where the algorithm cannot reliably compare elements of the array. For each pair of elements, there is a certain probability that the algorithm makes the wrong comparison. Noisy binary search can find the correct position of the target with a given probability that controls the reliability of the yielded position.[h][44][45] The noisy binary search problem can be considered as a case of the Rényi-Ulam game,[46] which Alfréd Rényi introduced in 1961.[47]

## History

In 1946, John Mauchly made the first mention of binary search as part of the Moore School Lectures, the first ever set of lectures regarding any computer-related topic.[48] Every published binary search algorithm worked only for arrays whose length is one less than a power of two[i] until 1960, when Derrick Henry Lehmer published a binary search algorithm that worked on all arrays.[50] In 1962, Hermann Bottenbruch presented an ALGOL 60 implementation of binary search that placed the comparison for equality at the end, increasing the average number of iterations by one, but reducing to one the number of comparisons per iteration.[8] The uniform binary search was presented to Donald Knuth in 1971 by A. K. Chandra of Stanford University and published in Knuth's The Art of Computer Programming.[48] In 1986, Bernard Chazelle and Leonidas J. Guibas introduced fractional cascading as a method to solve numerous search problems in computational geometry.[17][51][52]

## Implementation issues

Although the basic idea of binary search is comparatively straightforward, the details can be surprisingly tricky ... — Donald Knuth[2]

When Jon Bentley assigned binary search as a problem in a course for professional programmers, he found that ninety percent failed to provide a correct solution after several hours of working on it,[53] and another study published in 1988 shows that accurate code for it is only found in five out of twenty textbooks.[54] Furthermore, Bentley's own implementation of binary search, published in his 1986 book Programming Pearls, contained an overflow error that remained undetected for over twenty years. The Java programming language library implementation of binary search had the same overflow bug for more than nine years.[55]

In a practical implementation, the variables used to represent the indices will often be of fixed size, and this can result in an arithmetic overflow for very large arrays. If the midpoint of the span is calculated as (L + R) / 2, then the value of L + R may exceed the range of integers of the data type used to store the midpoint, even if L and R are within the range. If L and R are nonnegative, this can be avoided by calculating the midpoint as L + (RL) / 2.[56]

If the target value is greater than the greatest value in the array, and the last index of the array is the maximum representable value of L, the value of L will eventually become too large and overflow. A similar problem will occur if the target value is smaller than the least value in the array and the first index of the array is the smallest representable value of R. In particular, this means that R must not be an unsigned type if the array starts with index 0.

An infinite loop may occur if the exit conditions for the loop are not defined correctly. Once L exceeds R, the search has failed and must convey the failure of the search. In addition, the loop must be exited when the target element is found, or in the case of an implementation where this check is moved to the end, checks for whether the search was successful or failed at the end must be in place. Bentley found that, in his assignment of binary search, most of the programmers who implemented binary search incorrectly made an error defining the exit conditions.[8][57]

## Library support

Many languages' standard libraries include binary search routines:

• C provides the function bsearch() in its standard library, which is typically implemented via binary search (although the official standard does not require it so).[58]
• C++'s Standard Template Library provides the functions binary_search(), lower_bound(), upper_bound() and equal_range().[59]
• COBOL provides the SEARCH ALL verb for performing binary searches on COBOL ordered tables.[60]
• Java offers a set of overloaded binarySearch() static methods in the classes Arrays and Collections in the standard java.util package for performing binary searches on Java arrays and on Lists, respectively.[61][62]
• Microsoft's .NET Framework 2.0 offers static generic versions of the binary search algorithm in its collection base classes. An example would be System.Array's method BinarySearch<T>(T[] array, T value).[63]
• Python provides the bisect module.[64]
• Ruby's Array class includes a bsearch method with built-in approximate matching.[65]
• Go's sort standard library package contains the functions Search, SearchInts, SearchFloat64s, and SearchStrings, which implement general binary search, as well as specific implementations for searching slices of integers, floating-point numbers, and strings, respectively.[66]
• For Objective-C, the Cocoa framework provides the NSArray -indexOfObject:inSortedRange:options:usingComparator: method in Mac OS X 10.6+.[67] Apple's Core Foundation C framework also contains a CFArrayBSearchValues() function.[68]

## Notes and references

### Notes

1. ^ This happens as binary search will not always divide the array perfectly. Take for example the array [1, 2 ... 16]. The first iteration will select the midpoint of 8. On the left subarray are eight elements, but on the right are nine. If the search takes the right path, there is a higher chance that the search will make the maximum number of comparisons.[12]
2. ^ Knuth showed on his MIX computer model, intended to represent an ordinary computer, that the average running time of this variation for a successful search is ${\textstyle 17.5\log _{2}n+17}$ units of time compared to ${\textstyle 18\log _{2}n-16}$ units for regular binary search. The time complexity for this variation grows slightly more slowly, but at the cost of higher initial complexity.[15]
3. ^ It is possible to perform hashing in guaranteed constant time.[20]
4. ^ The worst binary search tree for searching can be produced by inserting the values in sorted or near-sorted order or in an alternating lowest-highest record pattern.[25]
5. ^ Knuth 1998 performed a formal time performance analysis of both of these search algorithms. On Knuth's hypothetical MIX computer, intended to represent an ordinary computer, binary search takes on average ${\textstyle 18\log n-16}$ units of time for a successful search, while linear search with a sentinel node at the end of the list takes ${\textstyle 1.75n+8.5-{\frac {n{\text{ mod }}2}{4n}}}$ units. Linear search has lower initial complexity because it requires minimal computation, but it quickly outgrows binary search in complexity. On the MIX computer, binary search only outperforms linear search with a sentinel if ${\textstyle n>44}$.[12][29]
6. ^ As simply setting all of the bits which the hash functions point to for a specific key can affect queries for other keys which have a common hash location for one or more of the functions.[33]
7. ^ There exist improvements of the Bloom filter which improve on its complexity or support deletion; for example, the cuckoo filter exploits cuckoo hashing to gain these advantages.[33]
8. ^ Using noisy comparisons, Ben-Or & Hassidim 2008 established that any noisy binary search procedure must make at least ${\displaystyle (1-\tau ){\frac {\log _{2}n}{H(p)}}-{\frac {10}{H(p)}}}$ comparisons on average, where ${\displaystyle H(p)=-p\log _{2}p-(1-p)\log _{2}(1-p)}$ is the binary entropy function and ${\displaystyle \tau }$ is the probability that the procedure yields the wrong position.[43]
9. ^ That is, arrays of length 1, 3, 7, 15, 31 ...[49]

### Citations

1. ^ Willams, Jr., Louis F. (1975). A modification to the half-interval search (binary search) method. Proceedings of the 14th ACM Southeast Conference. pp. 95–101. doi:10.1145/503561.503582.
2. ^ a b Knuth 1998, §6.2.1 ("Searching an ordered table"), subsection "Binary search".
3. ^ "Lecture 9: Binary Chop" (PDF). www.doc.ic.ac.uk. Imperial College London.
4. ^ Cormen et al. 2009, p. 39.
5. ^
6. ^ a b c Flores, Ivan; Madpis, George (1971). "Average binary search length for dense ordered lists". Communications of the ACM. 14 (9): 602–603. doi:10.1145/362663.362752.
7. ^ a b Knuth 1998, §6.2.1 ("Searching an ordered table"), subsection "Algorithm B".
8. ^ a b c Bottenbruch, Hermann (1962). "Structure and Use of ALGOL 60". Journal of the ACM. 9 (2): 161–211. doi:10.1145/321119.321120. Procedure is described at p. 214 (§43), titled "Program for Binary Search".
9. ^ a b Sedgewick & Wayne 2011, §3.1, subsection "Rank and selection".
10. ^ Goldman & Goldman 2008, pp. 461–463.
11. ^ Sedgewick & Wayne 2011, §3.1, subsection "Range queries".
12. Knuth 1998, §6.2.1 ("Searching an ordered table"), subsection "Further analysis of binary search".
13. ^ Chang 2003, p. 169.
14. ^ Sloane, Neil. Table of n, 2n for n = 0..1000. Part of OEIS A000079. Retrieved 30 April 2016.
15. ^ a b Knuth 1998, §6.2.1 ("Searching an ordered table"), subsection "Exercise 23".
16. ^ Rolfe, Timothy J. (1997). "Analytic derivation of comparisons in binary search". ACM SIGNUM Newsletter. 32 (4): 15–19. doi:10.1145/289251.289255.
17. ^ a b c d Chazelle, Bernard; Liu, Ding (2001). Lower bounds for intersection searching and fractional cascading in higher dimension. 33rd ACM Symposium on Theory of Computing. pp. 322–329. doi:10.1145/380752.380818.
18. ^ Knuth 1997, §2.2.2 ("Sequential Allocation").
19. ^ Knuth 1998, §6.4 ("Hashing").
20. ^ Knuth 1998, §6.4 ("Hashing"), subsection "History".
21. ^ Dietzfelbinger, Martin; Karlin, Anna; Mehlhorn, Kurt; Meyer auf der Heide, Friedhelm; Rohnert, Hans; Tarjan, Robert E. (August 1994). "Dynamic Perfect Hashing: Upper and Lower Bounds". SIAM Journal on Computing. 23 (4): 738–761. doi:10.1137/S0097539791194094.
22. ^ Morin, Pat. "Hash Tables" (PDF). p. 1. Retrieved 28 March 2016.
23. ^ a b Beame, Paul; Fich, Faith E. (2001). "Optimal Bounds for the Predecessor Problem and Related Problems". Journal of Computer and System Sciences. 65 (1): 38–72. doi:10.1006/jcss.2002.1822.
24. ^ Sedgewick & Wayne 2011, §3.2 ("Binary Search Trees"), subsection "Order-based methods and deletion".
25. ^ Knuth 1998, §6.2.2 ("Binary tree searching"), subsection "But what about the worst case?".
26. ^ Sedgewick & Wayne 2011, §3.5 ("Applications"), "Which symbol-table implementation should I use?".
27. ^ Knuth 1998, §5.4.9 ("Disks and Drums").
28. ^ Knuth 1998, §6.2.4 ("Multiway trees").
29. ^ Knuth 1998, Answers to Exercises (§6.2.1) for "Exercise 5".
30. ^ Knuth 1998, §6.2.1 ("Searching an ordered table").
31. ^ Sedgewick & Wayne 2011, §3.2 ("Ordered symbol tables").
32. ^ Knuth 2011, §7.1.3 ("Bitwise Tricks and Techniques").
33. ^ a b Fan, Bin; Andersen, Dave G.; Kaminsky, Michael; Mitzenmacher, Michael D. (2014). Cuckoo Filter: Practically Better Than Bloom. Proceedings of the 10th ACM International on Conference on emerging Networking Experiments and Technologies. pp. 75–88. doi:10.1145/2674005.2674994.
34. ^ Bloom, Burton H. (1970). "Space/time Trade-offs in Hash Coding with Allowable Errors". Communications of the ACM. 13 (7): 422–426. doi:10.1145/362686.362692.
35. ^ Knuth 1998, §6.2.1 ("Searching an ordered table"), subsection "An important variation".
36. ^ Knuth 1998, §6.2.1 ("Searching an ordered table"), subsection "Algorithm U".
37. ^ Kiefer, J. (1953). "Sequential Minimax Search for a Maximum". Proceedings of the American Mathematical Society. 4 (3): 502–506. JSTOR 2032161. doi:10.2307/2032161.
38. ^ Hassin, Refael (1981). "On Maximizing Functions by Fibonacci Search". Fibonacci Quarterly. 19: 347–351.
39. ^ Moffat & Turpin 2002, p. 33.
40. ^ a b c Knuth 1998, §6.2.1 ("Searching an ordered table"), subsection "Interpolation search".
41. ^ Knuth 1998, §6.2.1 ("Searching an ordered table"), subsection "Exercise 22".
42. ^ Perl, Yehoshua; Itai, Alon; Avni, Haim (1978). "Interpolation search—a log log n search". Communications of the ACM. 21 (7): 550–553. doi:10.1145/359545.359557.
43. ^ Ben-Or, Michael; Hassidim, Avinatan (2008). "The Bayesian Learner is Optimal for Noisy Binary Search (and Pretty Good for Quantum as Well)" (PDF). 49th Symposium on Foundations of Computer Science: 221–230. doi:10.1109/FOCS.2008.58.
44. ^ Pelc, Andrzej (1989). "Searching with known error probability". Theoretical Computer Science. 63 (2): 185–202. doi:10.1016/0304-3975(89)90077-7.
45. ^ Rivest, Ronald L.; Meyer, Albert R.; Kleitman, Daniel J.; Winklmann, K. Coping with errors in binary search procedures. 10th ACM Symposium on Theory of Computing. doi:10.1145/800133.804351.
46. ^ Pelc, Andrzej (2002). "Searching games with errors—fifty years of coping with liars". Theoretical Computer Science. 270 (1-2): 71–109. doi:10.1016/S0304-3975(01)00303-6.
47. ^ Rényi, Alfréd (1961). "On a problem in information theory". Magyar Tudományos Akadémia Matematikai Kutató Intézetének Közleményei (in Hungarian). 6: 505–516. MR 0143666.
48. ^ a b Knuth 1998, §6.2.1 ("Searching an ordered table"), subsection "History and bibliography".
49. ^ "2n−1". OEIS A000225. Retrieved 7 May 2016.
50. ^ Lehmer, Derrick (1960). Teaching combinatorial tricks to a computer. Proceedings of Symposia in Applied Mathematics. 10. pp. 180–181. doi:10.1090/psapm/010.
51. ^ Chazelle, Bernard; Guibas, Leonidas J. (1986). "Fractional cascading: I. A data structuring technique" (PDF). Algorithmica. 1 (1): 133–162. doi:10.1007/BF01840440.
52. ^ Chazelle, Bernard; Guibas, Leonidas J. (1986), "Fractional cascading: II. Applications" (PDF), Algorithmica, 1 (1): 163–191, doi:10.1007/BF01840441
53. ^ Bentley 2000, §4.1 ("The Challenge of Binary Search").
54. ^ Pattis, Richard E. (1988). "Textbook errors in binary searching". SIGCSE Bulletin. 20: 190–194. doi:10.1145/52965.53012.
55. ^ Bloch, Joshua (2 June 2006). "Extra, Extra – Read All About It: Nearly All Binary Searches and Mergesorts are Broken". Google Research Blog. Retrieved 21 April 2016.
56. ^ Ruggieri, Salvatore (2003). "On computing the semi-sum of two integers" (PDF). Information Processing Letters. 87 (2): 67–71. doi:10.1016/S0020-0190(03)00263-1.
57. ^ Bentley 2000, §4.4 ("Principles").
58. ^ "bsearch – binary search a sorted table". The Open Group Base Specifications (7th ed.). The Open Group. 2013. Retrieved 28 March 2016.
59. ^ Stroustrup 2013, §32.6.1 ("Binary Search").
60. ^ Unisys (2012), COBOL ANSI-85 Programming Reference Manual, 1, pp. 598–601
61. ^ "java.util.Arrays". Java Platform Standard Edition 8 Documentation. Oracle Corporation. Retrieved 1 May 2016.
62. ^ "java.util.Collections". Java Platform Standard Edition 8 Documentation. Oracle Corporation. Retrieved 1 May 2016.
63. ^ "List<T>.BinarySearch Method (T)". Microsoft Developer Network. Retrieved 10 April 2016.
64. ^ "8.5. bisect — Array bisection algorithm". The Python Standard Library. Python Software Foundation. Retrieved 10 April 2016.
65. ^ Fitzgerald 2007, p. 152.
66. ^ "Package sort". The Go Programming Language. Retrieved 28 April 2016.
67. ^ "NSArray". Mac Developer Library. Apple Inc. Retrieved 1 May 2016.
68. ^ "CFArray". Mac Developer Library. Apple Inc. Retrieved 1 May 2016.