topic badge

14.02 Branching

Lesson

Are you ready?

Do you know what type of activities are able to be described using an algorithm?

Examples

Example 1

Choose all the tasks below that can be completed by following an algorithm.

A
Falling asleep
B
Falling in love
C
Cooking a meal from a recipe book
D
Building a toy out of lego
Worked Solution
Create a strategy

Choose the tasks that need step-by-step instructions.

Apply the idea

We can cook a meal by following the step-by-step instructions from a recipe book.

We can also build a toy out of lego by following the step-by-step instructions from a manual.

The answers are options C and D.

Idea summary

We can follow an algorithm to complete tasks step by step.

Branching

This video shows how flow charts can be used to represent algorithms, and also introduces the idea of branching.

Loading video...

Examples

Example 2

Follow the algorithm below:

  • Start with the number 8.

  • If it is even, add 7 then double it.

  • If it is odd, double it then add 7.

Worked Solution
Create a strategy

Follow the algorithms for the number 8.

Apply the idea

Since 8 is even, we do the action described in the second dot point. We add 7 and then double the answer:

\displaystyle 8+7\displaystyle =\displaystyle 15Add 7
\displaystyle 15\times 2\displaystyle =\displaystyle 30Double the answer
Idea summary

A branch is when the next step depends on an answer, or condition.

Outcomes

VCMNA221

Design algorithms involving branching and iteration to solve specific classes of mathematical problems

What is Mathspace

About Mathspace