Algorithms 2.1 Flowcharts, Pseudocode, structure diagrams Flashcards
Define flowchart
A flowchart is a method of representing the sequences of steps in an algorithm in the form of a diagram
State the different symbols that make up a flowchart and draw what they look like
Terminal
Process
Decision
Input/Output
Sub routine
Line
What does the Terminal symbol in a flowchart represent
Terminal symbol – represents the start of end of a process
What does the Process symbol in a flowchart represent
Process symbol – represents something being initialized, processed or calculated.
What does the Decision symbol in a flowchart represent
Decision symbol – represents the decision. It will have a yes or no, true or false outcomes which will be represented by two separate lines or paths exiting the shape.
What does the Input/Output symbol in a flowchart represent
Input/Output symbol – represents the input and output of data to the algorithm
What does the Sub routing symbol in a flowchart represent
Sub routing symbol – representing a call to a sub routine. A sub routine will have its own flowchart, but when you call it from the main program, you need to express that call using this symbol
What does the Line symbol in a flowchart represent
Line (with an arrow) - represents the control passing between connected shapes. It is the flow of the algorithm
Define pseudocode
Pseudocode is an alternative, text-based way of representing the sequence of steps in an algorithm
What does the prefix, pseudo mean
The prefix ‘pseudo’ means false or not genuine
State an advantage of pseudocode
Pseudocode allows us to lay down the logic of a problem in an almost-like-real-code way without worrying about the actual rules and syntax of a particular language
Create a flowchart asking the user to input two numbers, and display to the screen the larger number
file:///C:/Users/44748/Documents/flowcharts%20and%20pseudocode.pdf
Create an algorithm in pseudocode, equivalent to the flowchart
file:///C:/Users/44748/Documents/flowcharts%20and%20pseudocode.pdf
number1 = INPUT ()
number2 = INPUT ()
if number 1 > number 2 then
print(“The largest number is” + number1)
else
print(“The largest number is” + number2)
endif
When refining an algorithm what do you need to do
Step 1) Identify the areas of existing algorithm which need modifying
QUESTION: Refine this algorithm to output the largest of the three numbers entered by the user.
file:///C:/Users/44748/Documents/flowcharts%20and%20pseudocode.pdf
file:///C:/Users/44748/Documents/flowcharts%20and%20pseudocode.pdf