Developing Algorithms · Desenvolvimento de Algoritmos
| English | Português |
|---|---|
| algorithm/ˈælɡərɪθəm/ | algoritmo |
| finite/ˈfaɪnaɪt/ | finito |
| sequencing/ˈsiːkwənsɪŋ/ | sequenciamento |
| flowchart/ˈfləʊtʃɑːt/ | fluxograma |
| natural language/ˈnætʃərəl ˈlæŋɡwɪdʒ/ | linguagem natural |
| same result/seɪm rɪˈzʌlt/ | mesmo resultado |
| refine/rɪˈfaɪn/ | refinar |
| efficient/ɪˈfɪʃənt/ | eficiente |
What is an algorithm?
- An algorithm 算法 is a finite 有限的, step-by-step set of instructions to complete a task.
- "Finite" means it always ends after a limited number of steps.
- A recipe, a route to school, and a sorting method are all algorithms.
- Every program is built from algorithms.
O que é um algoritmo?
- Um algoritmo 算法 é um conjunto finito 有限的, passo a passo de instruções para completar uma tarefa.
- "Finite" significa que ele sempre termina após um número limitado de etapas.
- Uma receita, um trajeto para a escola e um método de ordenação são todos algoritmos.
- Todo programa é construído a partir de algoritmos.
An algorithm is: · Um algoritmo é:
"Finite" means it always ends after a limited number of steps. · "Finito" significa que sempre termina após um número limitado de passos.
Three building blocks
- Every algorithm can be built from three basic structures:
- sequencing 顺序: doing steps one after another;
- selection: choosing between paths;
- iteration: repeating steps.
Três blocos fundamentais
- Todo algoritmo pode ser construído a partir de três estruturas básicas:
- sequenciamento 顺序: executing steps one after another;
- seleção: escolhendo entre caminhos;
- iteração: repetindo passos.
Sequencing, selection, or iteration? · Sequenciamento, seleção ou iteração?
Every algorithm is built from three structures: sequencing (steps in order), selection (choosing a path), and iteration (repeating steps). · Todo algoritmo é construído a partir de três estruturas: sequenciamento (passos em ordem), seleção (escolher um caminho) e iteração (repetir passos).
Which are the three building blocks of algorithms? (Select all that apply) · Quais são os três blocos construtivos dos algoritmos? (Selecione todos os que se aplicam)
Sequencing, selection, and iteration build every algorithm. · Sequenciamento, seleção e iteração constroem todo algoritmo.
A flowchart, pseudocode, and natural language can all express: · Um fluxograma, pseudocódigo e linguagem natural podem expressar:
All three describe the same steps differently. · As três descrevem os mesmos passos de maneira diferente.
Two different algorithms can produce the same correct result, one faster than the other. · Dois algoritmos diferentes podem produzir o mesmo resultado correto, sendo um mais rápido que o outro.
Neither is "more correct" if both give the right answer. · Nenhum é "mais correto" se ambos derem a resposta certa.
Ways to express it
- You can express an algorithm as pseudocode, as a flowchart 流程图 (boxes and arrows), or in plain natural language 自然语言.
- All three describe the same steps in different forms.
- Different algorithms can give the same result 相同结果 — one short but slow, another longer but fast.
- Neither is "more correct" if both give the right answer.
Maneiras de expressar
- Você pode expressar um algoritmo como pseudocódigo, como um fluxograma 流程图 (caixas e setas), ou em linguagem natural 自然语言 clara.
- As três descrevem os mesmos passos em formas diferentes.
- Diferentes algoritmos podem dar o mesmo resultado 相同结果 — um curto mas lento, outro mais longo mas rápido.
- Nenhum é "mais correto" se ambos derem a resposta certa.
The "largest of three" algorithm runs on a=4, b=9, c=6. What does it output? · O algoritmo "maior de três" roda em a=4, b=9, c=6. O que ele retorna?
Start 4; 9 > 4 → 9; 6 > 9 is false → stays 9. · Começa com 4; 9 > 4 → 9; 6 > 9 é falso → permanece 9.
Improving an algorithm step by step to be correct, clear, and efficient is called ______. · Melhorar um algoritmo passo a passo para estar correto, claro e eficiente é chamado ______.
Refining follows testing, making the algorithm better each pass. · O refinamento segue aos testes, tornando o algoritmo melhor a cada passagem.
Refine for efficiency
- We refine 改进 an algorithm so it is correct, clear, and efficient 高效.
- Refining means improving it step by step after testing.
Largest of three. largest ← a; IF b > largest: largest ← b; IF c > largest: largest ← c; DISPLAY largest. For a=4, b=9, c=6: start 4; 9 > 4 → largest 9; 6 > 9 is false → stays 9. Output 9. This uses sequencing and selection.
Refine para eficiência
- Nós refinamos 改进 um algoritmo para que esteja correto, claro e eficiente 高效.
- Refinar significa melhorá-lo passo a passo após testar.
Maior de três. largest ← a; SE b > largest: largest ← b; SE c > largest: largest ← c; EXIBIR largest. Para a=4, b=9, c=6: inicie 4; 9 > 4 → maior 9; 6 > 9 é falso → permanece 9. Saída 9. Isso usa sequenciamento e seleção.
An algorithm is a finite set of steps, built from three structures: sequencing, selection, and iteration. You can express it as pseudocode, a flowchart, or natural language. Different algorithms can give the same result, so we refine them to be correct, clear, and efficient.
Um algoritmo é um conjunto finito de passos, construído a partir de três estruturas: sequenciamento, seleção e iteração. Você pode expressá-lo como pseudocódigo, um fluxograma ou linguagem natural. Diferentes algoritmos podem dar o mesmo resultado, então nós os refinamos para estarem corretos, claros e eficientes.