Basic Form Algorithm

in #f7 years ago

image

The algorithm itself has three basic forms, among others: Sequence Algorithm Sequence algorithm or sequential algorithm is an algorithm whose steps in sequence from beginning to end. The form of this sequential algorithm is one such example of a water-cooking algorithm. Step by step that run must order from top to bottom. Looping Algorithm Looping algorithm or algorithm repetition is an algorithm that runs several specific steps repeatedly or looping. On the problems we face, there is also a step that we must do repeatedly. An example of this looping algorithm is the clothes drying algorithm: 1) Prepare the clothesline. 2) Take one outfit that will be dried. 3) Squeeze the clothing first. 4) Place the clothes on the clothesline pole. 5) Repeat steps from 2 to 4 until the outfit is out. From the above algorithm, it can be seen that from step 2 to 4 must be done repeatedly until the clothes run out. Branching or Conditional Algorithm Conditional algorithm or conditional algorithm is an algorithm that runs the next step if there are conditions that can already be met. Here's one example of conditional algorithms: 1) Prepare the pan. 2) Put enough water into the pan. 3) cover the pan. 4) place the pot on the stove. 5) Turn on the stove. 6) When the water has boiled, then turn off the stove. 7) Lift the pan off the stove. The conditional algorithm is in step 6. When the water has boiled, then turn off the stove. So if the water is not boiling, then the stove is not turned off.