Definition Of Algorithm
- Algorithm is a sequence of logical steps of problem solving that are arranged systematically.
- The word logical here means true according to human logic.
- To be an algorithm, the sequence of steps taken to solve the problem must give the correct result.
Algorithm Writing
- In natural language (Indonesian, English, and other human languages)
- But often ambiguous
- Using a flow chart (flow chart)
- Good visually but bother if algorithm is long
- Using pseudo-code
- It is closer to the programming language, but it is difficult to understand by people who do not understand programming
Algorithm In Natural Language
- Take the first number and set
maks
equal to the first number - Take the second number and compare it to the
maks
- What if the second number is greater than the
maks
, the setmaks
equals the second number - Take the third number and compare it to the
maks
- If the third number is greater than the max, the set
maks
equals the third number - The
maks
variable contains the largest number. Show the results
Example algorithm 1
- There are 2 glasses. One contains tea and the other contains coffee. How do I change the contents of each glass?
The Answer
- Prepare backup glass X
- Pour glass of tea into glass X
- Pour a glass of coffee into a tea cup
- Pour a glass of X that contains tea into a coffee cup
IF YOU LIKE MY POST
FOLLOW ME AND UPVOTE
@auliaramadhn
MOTIVATION
You can not always talk, can not always move to help people. But the writing you write will forever be able to be used by people.
THANKS YOU