Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Binary search: Difference between revisions

From Coderwiki
new
 
link to Collection
 
Line 1: Line 1:
A '''binary search''' is a [[search algorithm]] which works by '''discarding''' half of an [[array]] or [[list]] in order to speed up search time.
A '''binary search''' is a [[search algorithm]] which works by '''discarding''' half of an [[array]], [[list]] or other [[collection]] in order to speed up search time.


== Advantages of a binary search ==
== Advantages of a binary search ==
Line 9: Line 9:
* [[Performance|Slower]] than a [[linear search]] on '''very''' small datasets
* [[Performance|Slower]] than a [[linear search]] on '''very''' small datasets
* Still very simple, but slightly more complex to implement
* Still very simple, but slightly more complex to implement
* The [[array]] or [[list]] '''must''' be [[Sort algorithm|in order]]
* The [[collection]] '''must''' be [[Sort algorithm|in order]]

Latest revision as of 07:56, 13 August 2025

A binary search is a search algorithm which works by discarding half of an array, list or other collection in order to speed up search time.

edit edit source
edit edit source