diff --git a/en/Search Algorithms/Exponential Search.md b/en/Search Algorithms/Exponential Search.md index bca641ab..3530b2c5 100644 --- a/en/Search Algorithms/Exponential Search.md +++ b/en/Search Algorithms/Exponential Search.md @@ -2,7 +2,7 @@ #### Prerequisites -- [Binary Search algorithm](https://github.com/faridevnz/Algorithms-Explanation/blob/master/en/Search%20Algorithms/Binary%20Search.md) +- [Binary Search algorithm](Binary%20Search.md) #### Problem Statement @@ -39,7 +39,7 @@ Now we can apply the binary search on the subarray from 512 and 1_000. #### Complexity Explanation - The complexity of the first part of the algorithm is **O( log *i* )** because if *i* is the position of the target in the array, after doubling the search *index* `⌈log(i)⌉` times, the algorithm will be at a search index that is greater than or equal to *i*. We can write `2^⌈log(i)⌉ >= i` -- The complexity of the second part of the algorithm also is **O ( log *i* )** because that is a simple Binary Search. The Binary Search complexity ( as explained [here](https://github.com/faridevnz/Algorithms-Explanation/blob/master/en/Search%20Algorithms/Binary%20Search.md) ) is O( *n* ) where *n* is the length of the array. In the Exponential Search, the length of the array on which the algorithm is applied is `2^i - 2^(i-1)`, put into words it means '( the length of the array from start to *i* ) - ( the part of array skipped until the previous iteration )'. Is simple verify that `2^i - 2^(i-1) = 2^(i-1) ` +- The complexity of the second part of the algorithm also is **O ( log *i* )** because that is a simple Binary Search. The Binary Search complexity ( as explained [here](Binary%20Search.md) ) is O( *n* ) where *n* is the length of the array. In the Exponential Search, the length of the array on which the algorithm is applied is `2^i - 2^(i-1)`, put into words it means '( the length of the array from start to *i* ) - ( the part of array skipped until the previous iteration )'. Is simple verify that `2^i - 2^(i-1) = 2^(i-1) ` After this detailed explanation we can say that the the complexity of the Exponential Search is: diff --git "a/es/Algoritmos de b\303\272squeda/B\303\272squeda exponencial.md" "b/es/Algoritmos de b\303\272squeda/B\303\272squeda exponencial.md" index 3dad7976..dbddf8c1 100644 --- "a/es/Algoritmos de b\303\272squeda/B\303\272squeda exponencial.md" +++ "b/es/Algoritmos de b\303\272squeda/B\303\272squeda exponencial.md" @@ -2,7 +2,7 @@ #### Requisitos previos -- [Algoritmo de búsqueda binaria](https://github.com/faridevnz/Algorithms-Explicación/blob/master/en/Search%20Algorithms/Binary%20Search.md) +- [Algoritmo de búsqueda binaria](Búsqueda%20binaria.md) #### Declaración de problema @@ -39,7 +39,7 @@ Ahora podemos aplicar la búsqueda binaria en el subarray de 512 y 1_000. #### Explicación de complejidad - La complejidad de la primera parte del algoritmo es **`O( log *i* )`** porque si *i* es la posición del destino en la matriz, después de duplicar la búsqueda *index* `⌈log(i)⌉` veces, el algoritmo estará en un índice de búsqueda que es mayor o igual que *i*. Podemos escribir `2^⌈log(i)⌉ >= i` -- La complejidad de la segunda parte del algoritmo también es **`O ( log *i* )`** porque se trata de una simple búsqueda binaria. La complejidad de búsqueda binaria ( como se explica [aquí](https://github.com/faridevnz/Algorithms-Explicación/blob/master/en/Search%20Algorithms/Binary%20Search.md) ) es `O(*n*)` donde *n* es la longitud de la matriz. En la búsqueda exponencial, la longitud de la matriz en la que se aplica el algoritmo es `2^i - 2^(i-1)`, en palabras significa `(la longitud de la matriz de principio a *i* ) - (la parte de matriz omitida hasta la iteración anterior)`. Es simple verificar que `2^i - 2^(i-1) = 2^(i-1)`. +- La complejidad de la segunda parte del algoritmo también es **`O ( log *i* )`** porque se trata de una simple búsqueda binaria. La complejidad de búsqueda binaria ( como se explica [aquí](Búsqueda%20binaria.md) ) es `O(*n*)` donde *n* es la longitud de la matriz. En la búsqueda exponencial, la longitud de la matriz en la que se aplica el algoritmo es `2^i - 2^(i-1)`, en palabras significa `(la longitud de la matriz de principio a *i* ) - (la parte de matriz omitida hasta la iteración anterior)`. Es simple verificar que `2^i - 2^(i-1) = 2^(i-1)`. Después de esta explicación detallada, podemos decir que la complejidad de la búsqueda exponencial es: