Asking a friend to grab you a glass of water seems like a simple ask. However, computers are not as smart as humans. Although computers can quickly complete complicated tasks, they still require explicit step-by-step instructions to be able to complete their assigned tasks.
The sets of rules given to a computer to accomplish tasks are called algorithms. For a computer to understand your algorithm and successfully accomplish the given task, the algorithm needs to have the following characteristics.
- Input: An algorithm must have specific input values that will be used in creating a desirable output. For example, in the algorithm for grabbing your friend a glass of water, the inputs are a glass and a water source.
- Output: The algorithm must return desired outcomes based on the inputs. For example, a glass of water specially delivered to your friend is the output of the algorithm.
- Finiteness: There must be a finite number of steps after which the algorithm must terminate. That is, after completing pre-defined steps – as grabbing the glass, filling the glass to the brim, and bringing the filled glass to your friend – the algorithm must stop running.
- Definitiveness: All the steps of the algorithms must be explicitly defined. Remember, there is no room for vagueness where computers are concerned!
- Effectiveness: Your computer must be able to complete each step of the algorithm in time. A rule of thumb is to test your algorithm by hand step-by-step. If you can understand each step and arrive at the desired outcome, then your algorithm is probably effective.
In the next post of this series, we will introduce a get-me-water algorithm to clearly differentiate between effective and ineffective algorithms.
Recommend0 recommendationsPublished in Coding & STEAM, Lessons, Teens