Skip to content

Instantly share code, notes, and snippets.

@parzibyte
Created August 7, 2019 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save parzibyte/1fb51ddadc72ff42721d8432f4b0a82a to your computer and use it in GitHub Desktop.
Save parzibyte/1fb51ddadc72ff42721d8432f4b0a82a to your computer and use it in GitHub Desktop.
<?php
$arreglo = ["auto", "avispa", "avión", "computadora", "gato", "perro", "tarjeta"];
$busqueda = "computadora";
$izquierda = 0;
$derecha = count($arreglo) - 1;
$indice = busquedaBinariaRecursiva($arreglo, $busqueda, $izquierda, $derecha);
echo "El elemento $busqueda está en el índice $indice";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment