La Recherche Binaire, également connue sous le nom de Recherche Dichotomique, est un algorithme utilisé pour localiser la position d'un élément dans un tableau trié.
Son fonctionnement est le suivant:
- On imagine le tableau comme une plage avec un début et une fin.
- On examine l'élément situé au milieu de cette plage (généralement en utilisant la formule
(debut + fin) / 2
). - On réduit ensuite la plage de recherche en fonction de cet élément.
Visualisation d'une recherche dichotomique, où 4 est la valeur recherchée:
Label | Tags | Date |
---|---|---|
35. Search Insert Position | Array , Binary Search |
09-03-2024 |
69. Sqrt(x) | Math , Binary Search |
29-03-2024 |
349. Intersection of Two Arrays | Array , Hash Table , Binary Search , Sorting |
10-03-2024 |
704. Binary Search | Array , Binary Search |
09-03-2024 |
744. Find Smallest Letter Greater Than Target | Array , Binary Search |
09-03-2024 |
1351. Count Negative Numbers in a Sorted Matrix | Array , Binary Search , Matrix |
09-03-2024 |
2540. Minimum Common Value | Array , Hash Table , Two Pointers , Binary Search |
09-03-2024 |
2824. Count Pairs Whose Sum is Less than Target | Array , Two Pointers , Binary Search , Sorting |
30-06-2024 |
Label | Tags | Date |
---|---|---|
33. Search in Rotated Sorted Array | Array , Binary Search |
03-05-2024 |
34. Find First and Last Position of Element in Sorted Array | Array , Binary Search |
09-03-2024 |
2812. Find the Safest Path in a Grid | Array , Binary Search , Breadth-First Search , Union Find , Matrix |
15-05-2024 |
3143. Maximum Points Inside the Square | Array , Hash Table , String , Binary Search , Sorting |
06-07-2024 |
Label | Tags | Date |
---|---|---|
4. Median of Two Sorted Arrays | Array , Binary Search , Divide and Conquer |
19-02-2024 |