Algorithm Components and Algorithm Expression Patterns
Subjects:
- What Should be in the Algorithm
- Algorithm Expression Patterns
What Should be in the Algorithm
- Clarity
- Input
- Output
- Accuracy
- Efficiency
- Configuration
- Processing Time
- Memory Usage
- Splitting into subproblems
- Reusability
Let’s examine these items now.
- Clarity: The algorithm should state the steps to be performed step by step in a clear and understandable way.
- Input: The algorithm must specify what type of data to use as input and how to get that data.
- Output: The algorithm must specify what kind of output will be obtained as a result of the operation and how this output will be presented.
- Accuracy: The algorithm must fully and accurately describe the operations required to produce the correct results.
- Efficiency: The working of the algorithm should be designed to solve the given problem as soon as possible.
- Configuration: The algorithm should have a structure that follows step-by-step processes from a starting point.
- Processing time: The algorithm must specify how much time is needed to process the given inputs.
- Memory usage: The algorithm must specify how much memory the data will use and whether this memory usage is sufficient.
- Splitting into subproblems: The algorithm should make large problems easier to solve by dividing them into smaller subproblems.
- Reusability: The algorithm should be reusable for similar problems.
Routinely Going to School Algorithm:
- Start
- Wake up
- Take a shower
- Get ready
- Have breakfast
- Get out
- Wait for the bus
- Get on the bus
- Get off the bus when you arrive in front of the school
- Enter to school
- End
Algorithm Expression Patterns
1. Writing the algorithm as text
2. Pseudo Code
3. Algorithm Flowcharts
Writing the Algorithm as Text
The problem to be solved is written step by step as text and each line is numbered. It starts with “Start” and ends with “End”.
1- Start
2- Enter the number (A)
3- Calculate the square of the number (Square = AA)*
4- Write the result (square)
5- End
Pseudo Code:
This is a Algorithm is a form of expression that is similar to everyday speech but far from the details of any programming language.
Here is a pseudo code that states the state of water at a given temperature:
1- Write a program description message
2- Write a warning message for the user to enter the temperature
3- Read the entered temperature
4- If the temperature is 0 degrees Status = “Ice”
5- If temperature > = 100 Status = “Steam”
6- If not status = “Water”
7- Write the result
Algorithm Flowcharts:
The steps are written in specific symbols and the relationships and direction between the steps are indicated by arrows.
The shapes have various meanings as you can see in the image below.
“Is the Lamb Working??” Algorithm
Summary
- 10 important items that should be in the algorithm are listed. These features that should be in the algorithm; Clarity, Input, Output, Accuracy, Efficiency, Configuration, Processing Time, Memory Usage, Splitting into subproblems, Reusability.
- Examples of writing as text, pseudo code and flowcharts are also given as algorithm expression forms.