Skip to content · ⁨Passer au contenu⁩

Searching: linear and binary · ⁨Recherche : linéaire et binaire⁩

English

Finding a value

  • A common job is to search: is a value in an array, and where?
  • The usual answer is the index where we found it, or -1 if it is not there.
  • We learn two ways: linear search (works on any array) and binary search (needs a sorted array, but is much faster).
Français

Trouver une valeur

  • Une tâche courante est la recherche : une valeur existe-t-elle dans un tableau, et où ?
  • La réponse habituelle est l'index où nous l'avons trouvée, ou -1 si elle n'y est pas.
  • Nous apprenons deux méthodes : recherche linéaire (fonctionne sur tout tableau) et recherche binaire (nécessite un tableau trié, mais est beaucoup plus rapide).

Handout · ⁨Fiche de cours⁩

Log in or create account · ⁨Se connecter ou créer un compte⁩

IGCSE, A-Level & AP