Skip Top Navigation Bar

Representing Algorithms as Flowcharts

Algorithms can be written in multiple ways. We have been writing our algorithms using pseudocode. Using pseudocode allows you to write the algorithm using your own words and often in steps.

Flowcharts

You can also represent algorithms using flowchart symbols. Flowcharting can be considered outdated and too rigid, but for some people, it provides a more structured way to look at the algorithm that would assist them later when translating an algorithm into program code.

We can use flowchart symbols to create this same algorithm. In the flowchart, the following symbols are used:

Symbol Description Example Explanation of Example
Used to start and end the algorithm. This symbol is used to start your algorithm.
Used to represent a single step. Calculates the quotient of dividing totalTemp by 30 and averageTemp is assigned the result.
Used to make a decision, with the steps to take when it is true, going to the right and the steps to take when it is false, going to the left. Checks to see if your birthday (YourBday) is today. If it is, then it adds a free cookie (FreeCookie) reward to your account.
The diamond symbol is also used to represent the decision for whether or not the statements should repeat. Checks to see if the number of repetitions (numReps) is less than or equal to 10. If it is, then it simulates a jumping jack (jumpingJack) and increases the number of repetitions (numReps) by 1.
Used to create a path for the algorithm to follow from one step to the next step.

Brushing Teeth Algorithm

Pseudocode Example

For example, the following represents an example of pseudocode that could be used to brush your teeth in the morning.

  1. Get out the toothbrush and toothpaste and uncap it.
  2. Wet the toothbrush with water from the sink faucet.
  3. Put about a quarter inch of toothpaste on the bristles of the toothbrush.
  4. For each one of your teeth:
    • scrub in circular motions on the front, back, and top of your tooth
  5. Spit excess toothpaste into the sink
  6. Rinse your tooth brush

Flowchart Example

The following is the flowchart representation of the algorithm written in pseudocode above.

Your Turn

Grab a Piece of Paper, Let's Try It!

Re-write the algorithm you wrote of something you are really good at as a flowchart.

Resources

Next Learn Tutorial

Learn: Intro to Determining A Data Type