AdvertisementYour brand could be hereYour brand hereOn every Darslab page · students, parents and teachersinfo@darslab.comAsk for pricesPricesinfo@darslab.com
☰ Contents · Computing

Types of algorithms, ways to present them and practice

Lessons 10–11 · 2 lessons · M. R. Fayziyeva, D. M. Sayfurov, N. S. Xaytullayeva. Informatics and Information Technologies, Grade 9. “Nashriyot uyi Tasvir”, Tashkent, 2020
10

Types of algorithms and ways to present them

Textbook: pp. 30–34
GoalKnows the five ways to present an algorithm (words, formulas, table, graphic/flowchart, program) and tells the main flowchart blocks apart.
New words
flowchart: an algorithm drawn as blocks joined by arrows · blok-sxemablock: a shape in a flowchart standing for one kind of action · bloktabular algorithm: values or actions arranged in a table (timetable, table of values) · jadval ko‘rinishidagi algoritmprogram: an algorithm written in a language the computer understands · dastur
Explanation

An algorithm can be presented in five ways. In words: each instruction is a short command sentence. With formulas: the actions are given as mathematical formulas (handy for physics and chemistry problems). As a table: like a timetable or a table of values for y = x² – 3. In graphic form: a diagram, drawing, graph and above all a flowchart. As a program: the algorithm is written in a programming language. In a flowchart an oval stands for the start and end, a parallelogram for input and output, a rectangle for calculation and assignment, a rhombus (diamond) for a condition (with “yes” and “no” branches), a hexagon for a loop parameter, and a rectangle with side lines for a subprogram; the blocks are joined by lines with arrows. Because a flowchart is easy to see, it is widely used when preparing to program.

BlockMeaning
ovalstart and end
parallelograminput and output
rectanglecalculation and assignment
rhombuscondition (yes / no)
hexagonloop parameter
rectangle with side linessubprogram
💡 Where will I use this?
In real life

The class monitor drew the steps for watering the classroom plants as a flowchart: start, check the soil, ask “is it dry?”, if yes give a little water, if no do nothing, finish. A monitor from another group followed the chart without asking any questions.

Who uses it

Programmers, systems analysts and manual writers draw a process as a flowchart to make it clear to everyone.

Try it today

Draw an everyday task, such as choosing a book from a list, as a flowchart. Use a diamond for the decision; paper and pencil are enough.

Worked examples
StartaV = a · a · aS = 6 · a · aV, SEnd
Algorithm for the volume and surface area of a cube. In words: 1) start; 2) input the edge a; 3) compute V = a · a · a; 4) compute S = 6 · a · a; 5) output V and S; 6) end. As a flowchart: oval (start) → parallelogram (a) → rectangle (V, S) → parallelogram (output V, S) → oval (end).
x–2–1012
y1–2–3–21
As a table: for y = x² – 3 and x = –2, –1, 0, 1, 2 we get y = 1, –2, –3, –2, 1. As a formula: the weight force near the Earth’s surface is F = m · g. As a program this kind of algorithm will be written in Python in later lessons.
Class activity

“One algorithm – five forms”: a group prepares the algorithm “enter the room and switch on the light” as words, a flowchart and a table; the others point out the differences.

Practice
1
List the five ways to present an algorithm.
2
Which shape tests a condition in a flowchart and how many ways lead out of it?
3
Find the area of a circle of radius 10 with S = 3.14 · R².
4
Why is a flowchart useful before programming?
Story of the Week · The Khwarizmi WayChecking the first runClose the week: all of this week’s subjects in one storyRead →