Binary search algorithm
In computer science, binary search, also known as half-interval search, logarithmic search, or binary chop, is a search algorithm that finds the position of a target value within a sorted array. Binary search compares the target value to the middle element of the array. If they are not equal, the half in which the target cannot lie is eliminated and the search continues on the remaining half, again taking the middle element to compare to the target value, and repeating this until the target value is found. If the search ends with the remaining half being empty, the target is not in the array.
- Abstraction100002137
- Act100030358
- Activity100407535
- Algorithm105847438
- Arrangement107938773
- Classification107939638
- Dichotomy107939880
- Event100029378
- Group100031264
- Procedure101023820
- PsychologicalFeature100023100
- Rule105846932
- WikicatAlgorithms
- WikicatDichotomies
- WikicatSearchAlgorithms
- YagoPermanentlyLocatedEntity
- AverageTime
- Big O notation
- BestTime
- Big O notation
- Caption
- enVisualization of the binary search algorithm where 7 is the target value
- Class
- Search algorithm
- Comment
- enIn computer science, binary search, also known as half-interval search, logarithmic search, or binary chop, is a search algorithm that finds the position of a target value within a sorted array. Binary search compares the target value to the middle element of the array. If they are not equal, the half in which the target cannot lie is eliminated and the search continues on the remaining half, again taking the middle element to compare to the target value, and repeating this until the target value is found. If the search ends with the remaining half being empty, the target is not in the array.
- Data
- Array data structure
- Depiction
- Has abstract
- enIn computer science, binary search, also known as half-interval search, logarithmic search, or binary chop, is a search algorithm that finds the position of a target value within a sorted array. Binary search compares the target value to the middle element of the array. If they are not equal, the half in which the target cannot lie is eliminated and the search continues on the remaining half, again taking the middle element to compare to the target value, and repeating this until the target value is found. If the search ends with the remaining half being empty, the target is not in the array. Binary search runs in logarithmic time in the worst case, making comparisons, where is the number of elements in the array. Binary search is faster than linear search except for small arrays. However, the array must be sorted first to be able to apply binary search. There are specialized data structures designed for fast searching, such as hash tables, that can be searched more efficiently than binary search. However, binary search can be used to solve a wider range of problems, such as finding the next-smallest or next-largest element in the array relative to the target even if it is absent from the array. There are numerous variations of binary search. In particular, fractional cascading speeds up binary searches for the same value in multiple arrays. Fractional cascading efficiently solves a number of search problems in computational geometry and in 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.
- Is primary topic of
- Binary search algorithm
- Label
- enBinary search algorithm
- Link from a Wikipage to an external page
- sites.google.com/site/binarysearchcube/binary-search
- web.archive.org/web/20161104005739/https:/xlinux.nist.gov/dads/HTML/binarySearch.html
- algs4.cs.princeton.edu/home/
- Link from a Wikipage to another Wikipage
- .NET Framework
- Addison-Wesley
- Aegean Islands
- ALGOL 60
- Amortized analysis
- Array data structure
- Associative arrays
- Bernard Chazelle
- Best, worst and average case
- Big O notation
- Binary entropy function
- Binary logarithm
- Binary search tree
- Binary tree
- Bit
- Bit array
- Bloom filter
- B-tree
- C (programming language)
- C++
- Cache (computing)
- Category:2 (number)
- Category:Articles with example pseudocode
- Category:Search algorithms
- Catholicon (1286)
- Central processing unit
- COBOL
- Cocoa (API)
- Computational geometry
- Computer science
- Core Foundation
- CRC Press
- C standard library
- Cuckoo hashing
- D (programming language)
- Database
- Data mining
- Data structures
- Decimal computer
- Derrick Henry Lehmer
- Donald Knuth
- Edge case
- Exponential search
- False positives and false negatives
- File:Approximate-binary-search.svg
- File:Binary search complexity.svg
- File:Binary search example tree.svg
- File:Binary search tree search 4.svg
- File:Binary-search-work.gif
- File:Exponential search.svg
- File:Fractional cascading.svg
- File:Interpolation search.svg
- File:Noisy binary search.svg
- File:Uniform binary search.svg
- Filesystem
- Floating-point arithmetic
- Floor and ceiling functions
- Floor function
- Fractional cascading
- Function overloading
- Fusion tree
- Generic programming
- Go (programming language)
- Grover's algorithm
- Hash function
- Hash table
- Hash tables
- Hermann Bottenbruch
- Integer overflow
- Internet Protocol
- Interval (mathematics)
- Java (programming language)
- John Mauchly
- Jon Bentley (computer scientist)
- Judy array
- Leonidas J. Guibas
- Lexicographical order
- Linear interpolation
- Linear probing
- Linear search
- Locality of reference
- Logarithm
- Lookup table
- Merge sort
- Microsoft
- MIX
- Moore School Lectures
- Multiplicative inverse
- Natural logarithm
- Nearest neighbor search
- O'Reilly Media
- Objective-C
- Oxford University Press
- Pseudocode
- Python (programming language)
- Quantum algorithm
- Quantum computing
- Quicksort
- Random-access memory
- Range query (data structures)
- Real number
- Record (computer science)
- Ruby (programming language)
- Search algorithm
- Self-balancing binary search tree
- Sentinel node
- Set (abstract data type)
- Set (mathematics)
- Sexagesimal
- Sorted array
- Sorting algorithm
- Standard library
- Standard Template Library
- Stanford University
- Subroutine
- The Art of Computer Programming
- Time complexity
- Trie
- Twenty Questions
- Ulam's game
- Van Emde Boas tree
- W. Wesley Peterson
- Word RAM
- World Scientific
- Optimal
- enYes
- SameAs
- 2HvUU
- Algoritma pencarian biner
- Binærsøk
- Binäre Suche
- Binárne vyhľadávanie
- Binární vyhledávání
- Binar qidirish
- Binärsökning
- Binary search
- Binary search algorithm
- Bisectie
- Búsqueda binaria
- Căutare binară
- Cerca binària
- Dvojiško iskanje
- İkili arama algoritması
- İkili axtarış alqoritmi
- Kahendotsing
- Kërkimi binar
- m.01cmz
- Pesquisa binária
- Puolitushaku
- Q243754
- Recerca binari
- Recherche dichotomique
- Ricerca dicotomica
- Tìm kiếm nhị phân
- Wyszukiwanie binarne
- Δυαδική αναζήτηση
- Бинарна претрага
- Бинарно пребарување
- Двоично търсене
- Двоичный поиск
- Двійковий пошук
- חיפוש בינארי
- الگوریتم جستجوی دودویی
- خوارزمية البحث الثنائي
- द्विआधारी खोज प्रणाली
- বাইনারি অনুসন্ধান অ্যালগরিদম
- இருமத் தேடல் அல்கோரிதம்
- ಬೈನರಿ ಸರ್ಚ್ ಆಲಗೋರಿತಮ್
- ബൈനറി തിരയൽ
- การค้นหาแบบทวิภาค
- ორობითი ძებნის ალგორითმი
- 二分探索
- 二分搜尋演算法
- 이진 검색 알고리즘
- Space
- Big O notation
- Subject
- Category:2 (number)
- Category:Articles with example pseudocode
- Category:Search algorithms
- Thumbnail
- Time
- Big O notation
- WasDerivedFrom
- Binary search algorithm?oldid=1123691107&ns=0
- WikiPageLength
- 75114
- Wikipage page ID
- 4266
- Wikipage revision ID
- 1123691107
- WikiPageUsesTemplate
- Template:About
- Template:Academic peer reviewed
- Template:Anchor
- Template:Annotated link
- Template:Circa
- Template:Cite book
- Template:Closed access
- Template:Columns-list
- Template:Efn
- Template:Featured article
- Template:Harvnb
- Template:Infobox algorithm
- Template:Main
- Template:Math
- Template:Notelist
- Template:Open access
- Template:Quote
- Template:Reflist
- Template:Sfn
- Template:Short description
- Template:Use dmy dates
- Template:Wikibooks