Standard algorithms
Introducido
9:16
Ciclo de vida del desarrollo de programas
Cada aplicación en tu teléfono fue escrita por alguien como esto. Pero no empezaron escribiendo código. Antes de la primera línea, el problema fue estudiado, la solución…
Narración en inglés · subtítulos en inglés y 中文 que puedes cambiar
En esta lección
| English | Significado |
|---|---|
| algorithms/ˈælɡərɪθəmz/ | A finite sequence of precise steps for solving a problem or carrying out a task. |
| linear search/ˈlɪnɪə sɜːtʃ/ | búsqueda lineal |
| bubble sort/ˈbʌbl sɔːt/ | ordenamiento burbuja |
| counting/ˈkaʊntɪŋ/ | conteo |
| totalling/ˈtəʊtəlɪŋ/ | suma total |
| value/ˈvæljuː/ | An amount, number or item assigned to a variable or expression, or held by a data object. |
| list/lɪst/ | |
| sorting/ˈsɔːtɪŋ/ | |
| max/min | |
| average/ˈævrɪdʒ/ | |
| loop/luːp/ | A structure that repeats a sequence of instructions. |
| pass/pæs/ | |
| ascending order |
Las recetas clásicas
- Algunos algoritmos estándar aparecen una y otra vez.
- Debes conocer la búsqueda lineal (linear search), el ordenamiento burbuja (bubble sort) y los patrones de conteo/acumulación (counting/totalling).
- Cada uno es breve, pero vale la pena reconocerlos al instante.
Búsqueda lineal
DECLARE Found : BOOLEAN
Found ← FALSE
FOR I ← 1 TO 10
IF List[I] = SearchValue
THEN
Found ← TRUE
ENDIF
NEXT I
OUTPUT Found
- Una búsqueda lineal revisa cada elemento por su orden, desde el inicio, hasta que encuentra el valor (o llega al final).
- Funciona con cualquier lista — no se requiere ordenamiento previo.

Un diagrama de flujo para el algoritmo de suma, usando los símbolos estándar (inicio/fin, entrada/salida, proceso, decisión).

Standard algorithms
compare adjacent, swap if needed
Step through a bubble sort — compare neighbours and swap until everything is in order.
A linear search finds a value by:
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
Linear search examines items one by one until it finds the value or reaches the end.
Esta tarjeta se corrigió, por eso aparece en inglés hasta que se actualice su traducción.
Bubble sort
FOR Pass ← 1 TO 9
FOR I ← 0 TO 8
IF List[I] > List[I + 1]
THEN
Temp ← List[I]
List[I] ← List[I + 1]
List[I + 1] ← Temp
ENDIF
NEXT I
NEXT Pass
- A bubble sort 冒泡排序 compares each side-by-side pair and swaps them if they are out of order.
- It repeats this until no more swaps are needed — leaving the list sorted.

A bubble sort puts a list in order by:
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
It swaps out-of-order neighbours and repeats passes until no swaps are needed.
Acumulación, conteo, máximo/mínimo/promedio
- Acumulación — mantener un total acumulado:
Total ← Total + Value. - Conteo — sumar 1 cada vez que ocurre algo:
Count ← Count + 1. - Máximo/mínimo — mantener el valor mayor/menor visto hasta ahora.
- Promedio — dividir el total entre la cantidad de valores.

Which line adds a value to a running total?
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
Total ← Total + Value accumulates a sum; Count ← Count + 1 counts occurrences.
Match each standard algorithm to how it works.
Dificultad 2/5 · 140 monedas + un pequeño bono en el primer intento de hoy
These four — search, sort, total and max — are the building blocks of most exam algorithms.
Using totalling on the list [2, 4, 6, 8], what is the final total?
Dificultad 2/5 · 140 monedas + un pequeño bono en el primer intento de hoy
2 + 4 + 6 + 8 = 20.
Ya lo dominas
- La búsqueda lineal revisa cada elemento por su orden (funciona con cualquier lista).
- El ordenamiento burbuja intercambia vecinos desordenados, repitiendo hasta quedar ordenado.
- La acumulación (
Total ← Total + Value) y el conteo (Count ← Count + 1). - máx/mín = mantener lo mejor visto hasta ahora; promedio = total ÷ contador.
A linear search looks for 7 in the list 4 9 2 7 5. How many items does it compare before it finds 7, including 7 itself?
Dificultad 2/5 · 140 monedas + un pequeño bono en el primer intento de hoy
It checks 4, 9, 2, then 7: four comparisons.
A program has totalled 5 marks to get 340. What is the average?
Dificultad 1/5 · 100 monedas + un pequeño bono en el primer intento de hoy
Average = total ÷ count = 340 ÷ 5 = 68.
Esta tarjeta es nueva, por eso aparece en inglés hasta que su traducción esté lista.
You've got it
- linear search checks each item in turn (works on any list)
- bubble sort swaps out-of-order neighbours, repeating until sorted
- totalling (
Total ← Total + Value) and counting (Count ← Count + 1) - max/min 最大值/最小值 = keep the best so far; average = total ÷ count
¿Qué salió mal? Solo el equipo del sitio ve esta información.