Developing Algorithms
Đã giới thiệu| English | Ý nghĩa |
|---|---|
| algorithm/ˈælɡərɪθəm/ | thuật toán |
| finite/ˈfaɪnaɪt/ | hữu hạn |
| sequencing/ˈsiːkwənsɪŋ/ | sắp xếp thứ tự |
| flowchart/ˈfləʊtʃɑːt/ | sơ đồ tư duy |
| natural language/ˈnætʃərəl ˈlæŋɡwɪdʒ/ | ngôn ngữ tự nhiên |
| same result/seɪm rɪˈzʌlt/ | kết quả giống nhau |
| refine/rɪˈfaɪn/ | tinh chỉnh |
| efficient/ɪˈfɪʃənt/ | hiệu quả |
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.
An algorithm is:
Độ khó 1/5 · 100 xu + một phần thưởng nhỏ cho lần hoàn thành đầu tiên trong ngày
"Finite" means it always ends after a limited number of steps.
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.

A flowchart 流程图 lays out an algorithm using the standard symbols
Sequencing, selection, or iteration?
Every algorithm is built from three structures: sequencing (steps in order), selection (choosing a path), and iteration (repeating steps).
Which are the three building blocks of algorithms? (Select all that apply)
Độ khó 2/5 · 140 xu + một phần thưởng nhỏ cho lần hoàn thành đầu tiên trong ngày
Sequencing, selection, and iteration build every algorithm.
A flowchart, pseudocode, and natural language can all express:
Độ khó 1/5 · 100 xu + một phần thưởng nhỏ cho lần hoàn thành đầu tiên trong ngày
All three describe the same steps differently.
Two different algorithms can never produce the same correct result.
Độ khó 1/5 · 100 xu + một phần thưởng nhỏ cho lần hoàn thành đầu tiên trong ngày
False. Different algorithms can solve the same problem correctly; one may simply be faster than the other.
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.
The "largest of three" algorithm runs on a=4, b=9, c=6. What does it output?
Độ khó 2/5 · 140 xu + một phần thưởng nhỏ cho lần hoàn thành đầu tiên trong ngày
Start 4; 9 > 4 → 9; 6 > 9 is false → stays 9.
Improving an algorithm step by step to be correct, clear, and efficient is called ______.
Độ khó 1/5 · 100 xu + một phần thưởng nhỏ cho lần hoàn thành đầu tiên trong ngày
Refining follows testing, making the algorithm better each pass.
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.
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.