Binary search: Difference between revisions
From Coderwiki
More actions
new |
(No difference)
|
Revision as of 11:55, 9 August 2025
A binary search is a search algorithm which works by discarding half of an array or list in order to speed up search time.
Advantages of a binary search
- Almost always faster than a linear search
Disadvantages of a binary search
- Slower than a linear search on very small datasets
- Still very simple, but slightly more complex to implement
- The array or list must be in order