Creating Flowcharts

  1. Creating a flowchart is often a difficult task
    1. You are trying to think of a logical ordering of tasks to solve a problem, and that requires a lot of thought, depending on the complexity of the problem
    2. Don't be afraid to try different methods or refine a working method to make it simpler or more efficient
    3. Expect to use your eraser a lot!
    4. I usually start by writing out the variables I expect to use and then manipulate them from start to finish as I try various solutions to the given problem
  2. Flowcharting primitives
    1. Input: Get a number and call it X
    2. Output: Write the answer Z
    3. Assignment: A ← 10 or X ← Y + 2
    4. Basic arithmetic: + - * / and finding remainders
    5. Compare two values: Is X < Y? Is D = 0?
    6. Use sub-process (along with another flowchart) to build more sophisticated operations like determining if a number is prime
  3. How do you know your flowchart is correct?
    1. First make sure it is structured
    2. Try using a simple case. For example, if the flowchart is computing X to the power of Y, try 2 for X and 3 for Y to see if you get 8.
    3. After you've verified your flowchart works for the simple case, try other cases that you think could introduce logic errors. For example, what if X is 1 or 0?
    4. Common logic errors:
      1. Off-by-one error - A loop that performs one too many or one too few iterations
      2. Infinite loop - A loop that never terminates
      3. Never used statement - Process that will never execute because there is no logical path leading to the process
  4. OverFlow
    1. OverFlow was created by Gabriel Foust for creating flowcharts and watching them execute automatically
    2. Download OverFlow for free (Windows only)
    3. OverFlow tutorial