Skip to main content
Informatik.uz

What is an algorithm and why does it matter?

An algorithm is a precise, step-by-step set of instructions for solving a problem. We explain it with everyday examples and your first code.

1 min read
What is an algorithm and why does it matter? — cover
Contents

From brewing tea to a navigation app — it all runs on algorithms. An algorithm is a precise sequence of actions performed to solve a problem.

Key properties of an algorithm

  • Definiteness — every step must be understood in exactly one way
  • Finiteness — it ends after a limited number of steps
  • Effectiveness — it always produces a result
  • Generality — it works for a whole class of similar problems
  • Discreteness — it is divided into separate steps

An everyday example

The tea-making algorithm: fill the kettle with water, bring it to a boil, add the tea leaves, wait 5 minutes, then pour and drink. If we swap the order of the steps, the result changes — so sequence matters.

Your first algorithm: finding the largest number

eng_katta.py
1sonlar = [7, 3, 15, 9, 4]
2
3eng_katta = sonlar[0]
4for son in sonlar:
5 if son > eng_katta:
6 eng_katta = son
7
8print('Eng katta son:', eng_katta)

Tip: before writing code, sketch the algorithm on paper or as a flowchart.

Conclusion

Algorithmic thinking is not just for programmers — it teaches you to break a problem into parts and solve it logically.

Enjoyed this article? Share it

Keep reading