Exemple de méthode de recherche binaire Java (recherche binaire)
复制代码代码如下:public class HalfSearch {public static int halfSearch(int a[], int x) {int mid, left, right;left = 0;right = a.length - 1;mid = (gauche + droite) / 2; while (a[mid] != x) {if (x > a[mid]) {left = mid + 1;}else if (x < a[milieu]) {droite = m
2024-11-25