Algorithm what is an Algorithm?


Download 245.78 Kb.
Sana30.04.2023
Hajmi245.78 Kb.
#1403290
Bog'liq
ALGORITHM

ALGORITHM

What is an Algorithm?

An algorithm is a set of step-by-step procedures, or a set of rules to follow, for completing a specific task or solving a particular problem.

Algorithms are all around us. The recipe for baking a cake, the method we use to solve a long division problem, and the process of doing laundry are all examples of an algorithm.

Ways to describe algorithms:

Using formulas

In this case, the sequence of actions to be performed in the form of mathematical formulas, logical expressions is expressed.

Calculate the perimeter of the rectangle.

P=2a+2b

Using text

Sequence of actions to be performed expressed using sentences or sentences

An example. The surface of a circle with radius R calculate

Using a programming language

A sequence of actions is an algorithmic language expressed using codes

An example

a=4

b=5

s=a*b

print(s)

Using a graph

The sequence of actions is special geometric represented by figures.

Such a representation of the algorithm as an algorithm scheme or block diagram is conducted.

In the block diagram, each type of movement is known represented by a geometric figure.

These are figures connected by directional lines. Special for creating block diagrams blocks are used:

Flowcharts and its functions


For Start and end
For Process and calculations
For input and output
For Decision
For Flow Arrow

Types of algorithms

Any algorithm is divided into three main types depending on its logical structure, that is, the order of execution: linear (following), branching and iterative.

Linear algorithms. Algorithms in which all instructions are executed sequentially are called linear algorithms.

Examples of linear algorithms are "Tea brewing" and circle surface calculation algorithms. But many processes in our life are governed by conditions.

Branching algorithms.

Algorithms involving conditional instructions are called branching algorithms. This type of algorithms is found in our life every day and at every step.

Whether we go out depends on whether the door is open or closed, whether we eat on an empty stomach or on the type of food, what we dress up for when we go out, the weather, the choice of means of transport to go somewhere depends on the money we can afford.

Iterative (cyclic) algorithms.

During the analysis of problems, it can be observed that some instructions in the algorithm are executed repeatedly.

Many processes are repeated in our life. For example, repeating lessons every week, having breakfast or going to school every day, etc.

Algorithms whose instructions are repeated are called iterative algorithms.


Download 245.78 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling