Loading...
Hello, my name is Mrs. Holborow, and welcome to Computing.
I'm so pleased you've decided to join me for today's lesson.
In today's lesson, we're going to be looking at how we can use flowcharts to represent algorithms. Welcome to today's lesson from the unit Algorithms. This lesson is called Representing algorithms using flowcharts.
And by the end of today's lesson, you'll be able to create and represent an algorithm in a flowchart.
Should we make a start? We'll be exploring these keywords throughout today's lesson.
Flowchart.
Flowchart, a diagram that uses symbols to document the logic of an algorithm.
Symbol.
Symbol, a sign, shape or object that is used to represent something else.
Standardise.
Standardise, to make one thing the same as others of that type.
Look out for these keywords during today's lesson.
Today's lesson is broken into two parts.
We'll start by describing the reasons for using flowcharts.
We'll then move on to represent algorithms with flowcharts.
Let's make a start by describing the reasons for using flowcharts.
Diagrams are a popular way to share information.
Think about the last time you used a diagram.
What was it, and why was the information presented in a diagram? Aisha says, "I can think of lots of times that I've used diagrams, I wonder which one I used most recently?" Maybe pause the video whilst you have a think.
Ah, Aisha has an example: "I remember I built a toy with my brother this morning before school.
The instruction booklet was full of diagrams showing how to connect all the pieces correctly.
I think the information was presented in diagrams to make a complicated set of instructions easy to follow." That's a great example, Aisha.
Diagrams are often used to simplify complex information and make it easier for people to understand.
A flowchart is a diagram used to illustrate the steps of an algorithm.
So, here's an example of a flowchart.
Flowcharts are made up of symbols, each containing a single step of the algorithm.
The symbols used in flowcharts are defined by ISO, International Organisation for Standardisation.
Sam has a really good question.
"But why do the symbols need to be a certain standard?" Can you think of a response and why this might have to be the case? Using a standardised set of symbols ensures consistency, clarity and efficiency across different flowcharts.
It's important for people to be able to look at a flowchart that somebody else has created and understand it.
The shape of the symbol represents the type of process that the symbol contains.
So, an oval or rectangle with curved edges is known as a terminal.
A rectangle represents a process.
And arrows are known as flow lines.
A diamond represents a decision.
A parallelogram represents an input or an output.
And lastly, a rectangle with two lines inside shows a subprogram.
Time to check your understanding.
In a flowchart, which symbol is used to represent a decision? Is it A, B, or C? Pause the video whilst you have a think.
That's correct! The diamond is used to represent a decision in a flowchart.
The terminal symbol marks the start and end of a flowchart.
In a well-designed flowchart, you should only have one entry and one exit point.
The rectangle symbol represents a process.
This represents an operation or set of operations that change the value, form or location of data.
So, an example might be multiplying a score by 10.
The arrow symbol represents the direction of flow from one step to the next.
Flow is assumed to be from top to bottom and from the left to right.
If the flow is non-standard, then arrowheads need to be added.
The diamond symbol represents a decision.
So, here we've got a couple of examples.
One labelled with no or yes, and one labelled with False and True.
A decision is a conditional operation that will determine which one of two paths the programme will take.
The symbol usually contains a yes/no question or a true/false test.
The parallelogram symbol represents an input or output.
This symbol indicates the process of taking an input into the system or outputting data from the system.
So, for example, a print statement to the user.
A rectangle with two lines inside represents a subprogram.
This indicates a named process that is defined elsewhere.
This could be a function that performs a specific task.
This function may well have its own separate flowchart.
Time to check your understanding.
Which symbol is used at the start and end of a flowchart and is also known as a terminal? Is it A, B, or C? Pause the video whilst you have a think.
That's right! The correct answer is A.
Well done! Flowcharts can be useful tools for a number of reasons, such as: Providing visual clarity for complex problems. Checking logic and steps before writing code.
Providing excellent documentation for processes.
Note that for simple programmes, a flowchart may not be needed and could add to the development time.
Sometimes, the programme code itself might be clear enough without a flowchart.
Time to check your understanding.
A flowchart is: A, a written description to show how to solve a problem.
B, a computer programme to solve a problem.
Or C, a visual diagram that uses symbols to show how to solve a problem.
Pause the video whilst you have a think.
The correct answer is C, a flowchart is a visual diagram that uses symbols to show how to solve a problem.
Okay, we've come to our first set of tasks for today's lesson, and you're doing a fantastic job so far, so well done.
For part one, write the process name under each of these flowchart symbols.
And then, for part two, describe two reasons why someone may choose to create a flowchart.
Pause the video here whilst you complete the activity.
How did you get on? Great work! For part one, you were asked to write the process name underneath each of the flowchart symbols.
So, going from left to right on my screen: The first one was a terminal.
The rectangle is a process.
And then the diamond is a decision.
The next line: Parallelogram is input and output.
The rectangle with the two lines is a subroutine.
And the arrow is the flowline.
For part two, you were asked to describe two reasons why someone may choose to create a flowchart.
And Izzy has a sample answer here.
"One reason to create a flowchart is that a flowchart diagram can make it easier to understand a complex problem.
Another reason is that a flowchart is a useful tool to check the logic of an algorithm." That's great, Izzy! Two fabulous reasons there.
Well done! If you had something slightly different, don't worry, 'cause there are lots of reasons why we could use and create a flowchart.
Okay, we're now moving on to the second part of today's lesson, and you're doing a great job so far, so well done.
We're now going to represent algorithms with flowcharts.
Look at the section of the flowchart diagram below.
Sam says, "Something's not quite right." So, we've got a decision with a question that says, "Are teeth clean?" Sam has noticed something is not quite right with the decision part of his flowchart.
Can you spot the problem? Maybe pause the video whilst you have a think.
Ah, did you spot the problem? Sam had forgotten to add the condition check results to the output of the decision.
Sam says, "That's better, I can now see the flow direction based on the decision." So, we've added the yes and no labels.
A flowchart can be used to represent the algorithm of a coin toss game.
Look at the written description for a coin toss game below.
1, ask the user to guess either "Heads" or "Tails." 2, simulate a coin flip by randomly generating "Heads" or "Tails." 3, compare the coin flip with the user's choice.
4, if the coin flip is the same as the user's choice, tell the user they won.
Otherwise, tell the user they lost.
Okay, let's see how we can represent the coin toss programme in a flowchart.
We begin the flowchart with the start terminal.
We then ask the user to guess either "Heads" or "Tails" and store the response in a variable called choice.
So, we're outputting the message "Heads or tails?", and the user is inputting their choice.
So, we've used the parallelograms here.
We're then going to simulate a coin toss by randomly generating either "Heads" or "Tails," and we're gonna store this in a variable called flip.
This is a process, so it's in the rectangle.
We're then going to compare the coin flip with the user's choice.
So, is choice equal to flip? And we've got two options here.
So we've got a decision: true or false.
If true, we're going to output "You won!" to the user to tell them that they've won.
If false, then we're going to output "You lost." We then finish the flowchart with an end terminal.
Time to check your understanding.
Which of the following correctly represents how you would ask and take a user's name in a flowchart? Is it A, B, or C? Pause the video whilst you carefully have a look at the flowchart shapes.
Did you select A? Great work! Remember to look carefully at the flowchart shapes we're using.
In the first part, we're outputting to the user the question "What is your name?" So, this needs to be in a parallelogram.
In the second part, we're storing the user's input as the variable name.
So this is input, so again needs to be in a parallelogram.
True or false? A flowchart always needs to have a decision symbol.
Pause the video whilst you have a think.
Did you select false? Well done! Flowcharts should only use the symbols that are necessary to show the logic of a solution or a process.
If a decision is not needed in a flowchart, there's no need to use the symbol.
Flowcharts should be kept as simple and clear as possible.
Okay, we're now moving on to Task B of today's lesson.
Look at the written description of a dice game algorithm below.
1, generate a random number from 1 to 6 to simulate a dice roll.
2, simulate a second dice roll with a random number between 1 and 6.
3, compare the two dice values.
4, if the values are the same, tell the user they rolled a double.
5, otherwise, tell the user they did not roll a double.
Create a flowchart diagram that expresses the algorithm in a visual way.
Pause the video whilst you complete the activity.
How did you get on? Sam here has created a flowchart.
Let's have a look at it together.
So, at the top, we have the start.
We then have a process that says, dice1 = random number between 1-6.
So, generate a random number for the dice1.
We then have that repeated, but this time for dice2.
And then you have a decision, which says is dice1 equal to dice2? So are they the same? If the output from that discission is true, then the output is going to be "You rolled a double." Otherwise, the output is going to be "No double this time." And then, we finish the flowchart with the end symbol.
Sam says, "I really enjoyed creating this flowchart.
It's really easy to follow the logic and check if the algorithm works." Great work, Sam! Okay, we've come to the end of today's lesson, and you've done a fantastic job, so well done.
Let's summarise what we have learned together.
A flowchart is a diagram that uses symbols to show each step of an algorithm.
Flowchart symbols are standardised to ensure they are used consistently and are easy for people to read.
Flowcharts provide visual clarity to complex problems and make the logic easier to understand and check for errors.
I hope you enjoyed today's lesson, and I hope you'll join me again soon.
Bye!.