Selection in algorithms
An algorithmA sequence of logical instructions for carrying out a task. In computing, algorithms are needed to design computer programs. is a plan, a set of step-by-step instructions to solve a problem. There are three basic building blocks (constructs) to use when designing algorithms:
- sequencing
- selection
- iteration
These building blocks help to describe solutions in a form ready for programmingThe process of writing computer software..
What is selection?
Selection is a decision or question.
At some point in an algorithm there may need to be a question because the algorithm has reached a step where one or more options are available. Depending on the answer given, the algorithm will follow certain steps and ignore others.
Why is selection important?
Without selection, different paths would not be included in algorithms. This means that the solutions created would not be realistic.