committed by
Christopher McCormack
parent
10a7823d68
commit
069df4374a
@ -89,7 +89,7 @@ El código para la búsqueda binaria recursiva se muestra a continuación:
|
|||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
function binarySearch(arr, item, low, high) {
|
function binarySearch(arr, item, low, high) {
|
||||||
if (low > high) { // No more elements in the array.
|
if (low > high) { // No hay más elementos en la matriz.
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,7 +192,7 @@ int binary_search(int arr[], int l, int r, int target)
|
|||||||
|
|
||||||
### Implementacion Python
|
### Implementacion Python
|
||||||
|
|
||||||
```Python
|
```python
|
||||||
def binary_search(arr, l, r, target):
|
def binary_search(arr, l, r, target):
|
||||||
if r >= l:
|
if r >= l:
|
||||||
mid = l + (r - l)/2
|
mid = l + (r - l)/2
|
||||||
@ -265,4 +265,4 @@ C ++ - enfoque iterativo int binarySearch (int arr \[\], int start, int end, int
|
|||||||
### Más información
|
### Más información
|
||||||
|
|
||||||
* [Búsqueda binaria (video de YouTube)](https://youtu.be/P3YID7liBug)
|
* [Búsqueda binaria (video de YouTube)](https://youtu.be/P3YID7liBug)
|
||||||
* [Búsqueda binaria - CS50](https://www.youtube.com/watch?v=5xlIPT1FRcA)
|
* [Búsqueda binaria - CS50](https://www.youtube.com/watch?v=5xlIPT1FRcA)
|
||||||
|
Reference in New Issue
Block a user