8000 feat: Translate Linear Search to Spanish · JSSpagh/Algorithms-Explanation@d0d2037 · GitHub
[go: up one dir, main page]

Skip to content

Commit d0d2037

Browse files
committed
feat: Translate Linear Search to Spanish
1 parent 472a343 commit d0d2037

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Búsqueda lineal
2+
3+
#### Declaración de problema
4+
5+
Dada una matriz de `n` elementos, escriba una función para buscar el índice de un elemento determinado (destino)
6+
7+
#### Enfoque
8+
9+
- Comience a iterar con el primer elemento de la matriz.
10+
- Compararlo con el elemento objetivo.
11+
- Si es igual al elemento de destino, devuelva el índice.
12+
- De lo contrario, continúe iterando.
13+
- Devolver -1 si el elemento de destino no se encuentra en la matriz.
14+
15+
#### Complejidad horaria
16+
17+
`O(n)` Peor caso
18+< 8000 div class="diff-text-inner">`O(1)` Mejor caso (Si el primer elemento de matriz es el elemento de destino)
19+
20+
#### Complejidad espacial
21+
22+
`O(1)`
23+
24+
#### Ejemplo
25+
26+
```
27+
arr = [1, 3, 9, 5, 0, 2]
28+
29+
target = 5
30+
La búsqueda lineal debe devolver el índice 3, ya que 5 está en el índice 3.
31+
32+
target = 6
33+
La búsqueda lineal debe devolver -1 ya que 6 no está presente en la matriz
34+
```
35+
36+
#### Enlaces de implementación de código
37+
38+
- [Java](https://github.com/TheAlgorithms/Java/blob/master/Searches/LinearSearch.java)
39+
- [C++](https://github.com/TheAlgorithms/C-Plus-Plus/blob/master/Search/Linear%20Search.cpp)
40+
- [Python](https://github.com/TheAlgorithms/Python/blob/master/searches/linear_search.py)
41+
- [JavaScript](https://github.com/TheAlgorithms/Javascript/blob/master/Search/LinearSearch.js)
42+
- [C-Sharp](https://github.com/TheAlgorithms/C-Sharp/blob/master/Algorithms/Search/LinearSearcher.cs)
43+
- [C](https://github.com/TheAlgorithms/C/blob/master/searching/linear_search.c)
44+
- [Go](https://github.com/TheAlgorithms/Go/blob/master/searches/linearsearch.go)
45+
- [Rust](https://github.com/TheAlgorithms/Rust/blob/master/src/searching/linear_search.rs)
46+
- [Dart](https://github.com/TheAlgorithms/Dart/blob/master/search/linear_Search.dart)
47+
- [Ruby](https://github.com/TheAlgorithms/Ruby/blob/master/Searches/linear_search.rb)
48+
- [PHP](https://github.com/TheAlgorithms/PHP/blob/master/searches/linear_search.php)
49+
- [Kotlin](https://github.com/TheAlgorithms/Kotlin/blob/master/src/main/kotlin/search/LinearSearch.kt)
50+
- [Scala](https://github.com/TheAlgorithms/Scala/blob/master/src/main/scala/Search/LinearSearch.scala)
51+
- [OCaml](https://github.com/TheAlgorithms/OCaml/blob/master/searches/linear_search.ml)
52+
- [MATLAB-Octave](https://github.com/TheAlgorithms/MATLAB-Octave/blob/master/algorithms/Searching/linear_search.m)
53+
54+
#### Explicación en YouTube
55+
56+
[Un vídeo CS50 que explica el algoritmo de búsqueda lineal](https://www.youtube.com/watch?v=CX2CYIJLwfg)
57+
58+
#### Explicación de animación
59+
60+
- [Tute Board](https://boardhub.github.io/tute/?wd=linearSearchAlgo)

0 commit comments

Comments
 (0)
0