SelectionRepresenting selection in a flow diagram

When designing algorithms, there are many steps where decisions must be made. This decision is known as selection, and can be displayed in pseudocode or flow diagrams.

Part ofComputer ScienceAlgorithms

Representing selection in a flow diagram

A flow diagram (also known as a flowchart) is a diagram that explains the steps of an .

Consider this simple six-step algorithm for comparing your dog’s age with your own:

  • ask how old the dog is in human years
  • multiply human years by seven to find out how old the dog is in dog years
  • print answer on the screen
  • ask how old you are
  • if the dog’s age in dog years is older than your age, say ‘Your dog is older than you!’
  • otherwise, say ‘Your dog is not older than you.’

In a flow diagram, this sequence would look like this:

A flowchart comparing your age with your dog’s age will first ask for your dog’s age and then your age. Based on the calculation that 1 dog year equals 7 human years it will calculate who is older.