What is Algorithm and what is connection with programs?
All programming languages are based on algorithms. Algorithms can be implemented through programming languages.
Regardless of the language and usage area used in the program, there is no program without an algorithm. In the program, all inputs coming from outside for the operation of an algorithm are defined as "variables". Loops and operations in the algorithm take place over these variables.
All possibilities in the algorithm should be specified and clear. No possibility should be left to chance.
Every algorithm should be simple enough to be written down on paper. Algorithms can be represented in plain text or in flowcharts.
Flow charts show the operation of the algorithm in order, showing the cause-effect relationship.
Let's see couple of example of algorithm. We will write algorithm on a problem.
The problem can be take sum of the 3 numbers and lets say the variables should be x, y and z.
- step -> start
- step -> define x
- step -> define y
- step -> define z
- step -> result = (x+y+z)/3
- step -> show result to console
- step -> stop
A solution path consisting of a sequential and finite number of processing steps to be followed to solve a problem.
Sequential presentation of process steps on how to perform a task/job.
- It should be clear and unambiguous and should not include vague steps.
- Must have a start state and an end
- The order in which the steps will be performed should be clearly stated.
- In algorithms, large and complex operations are divided into smaller and simpler steps.
Do not forget, Key features of the algorithms are;
- Must be certain
- Must be executable
- Must be sequential
- Must be finite
How algorithms solves problems?
The process of writing correctly by designing appropriate syntax to enable people to communicate with machines is called programming. Programming consists of two sub-elements. Analysis/Design and Coding.
Analysis/Design -> Designing correctly for problem solving.
Coding -> Expressing this designed way with codes.
In other words, the way designed to solve the problem with coding is translated into a language that the computer can understand by using a programming language.
Therefore, what we call an algorithm is actually the solution to the problem that we put forward in the analysis and design process.
In other words, while creating the solution of a problem in computer language, it is revealing the general operation of the program with logically sequential processing steps before it is coded in a programming language at the analysis stage.
Problem solving in computer environment...
- Understanding the problem (examination, analysis).
- To present alternative solutions.
- To design the algorithm of the program by choosing one of the proposed solutions.
- Coding the designed algorithm in a programming language.
- Detecting errors in the editor where the program was coded and corrected them. to do.
- To test the operation of the program with sample input and output values.
Thanks for reading. Hope its help you about what exactly Algorithms and how to solves problems.
Top comments (0)