Flowcharts

A flowchart is a visual representation of a process.

Flowchart symbols are standardized, the way the text is written is not.

Flowchart Symbols

Terminator

Flow Arrow

Process

Decision

Input / Output

Input Example:

Output Example:

Data Store

Examples and Exercises

Determine if a number is even or odd and print the result

...

Print every other number from 2-10 (2, 4, 6, 8, 10)

...

Flowchart linear search algorithm

We will do this together using draw.io for the assignment today.


START
    // Get the inputs
    // In a realistic example, we may have the list coming from a file or database,
    // and the user entering the target value.
    GET list
    GET target

    // current_index represents the "spot" within the list that we are currently checking
    SET current_index = 1
    // Start by assuming the target is not found
    SET found = false

    WHILE current_index <= length of list:
        IF the item at the current index is the target:
            SET found = true
        END IF

        // Move to the next item in the list
        ADD 1 to current_index
    END WHILE

    // Output the result
    IF found is true:
        PRINT "Found at index", current_index
    ELSE:
        PRINT "Not found"
    END IF
END

Flowchart binary search algorithm

Instructor challenge... only if time.