`` Algorithmes `` www.scriptol.fr `` Recherche dichotomique récursive sur un tableau de textes `` Retourne l'index d'un élément du tableau `` ou -1 si le text ne peut être trouvé. `` Les textes doivent être classé en ordre ascendant dans le tableau. `` Le tableau est une variable globale ce qui optimise la vitesse `` et on se déplace avec les indices starting et ending. array A = { "alpha", "ariane", "beta", "bridget", "delphine", "delta", "omega", "orane", "pi", "ro", "rosana" } int size = A.size() text val int binarySearch(text value, int starting, int ending) if ending < starting return -1 int mid = (starting + ending) / 2 int result = strcmp(value, A[mid]) if result = 0 return mid < 0 ending = mid - 1 > 0 starting = mid + 1 /if return binarySearch(value, starting, ending) A.display() input "Donner un mot a chercher:", val int y = binarySearch(val, 0, A.size() - 1) if y >= 0 print val, "se trouve en position", y else print val, "ne figure pas dans le tableau..." /if