Bukit Timah Tutor Mathematics

A connected Mathematics learning system from school foundations to examinations, applications and advanced study. Use the Mathematics Hub to move between levels, concepts, diagnosis, examinations, applications and world routes.

Primary Mathematics: Mathematical Algorithms, Flowcharts and Decision Trees | Worked Learning Guide

Three primary students sit around open books at a classroom table while one gives a thumbs-up, with stationery and a whiteboard of lesson notes nearby.

BTT Mathematics / Primary Mathematics Learning Hub / Algorithms and Flowcharts

An algorithm is a finite sequence of unambiguous steps for completing a task. A flowchart makes those steps and decisions visible. A decision tree records how different conditions lead to different next actions or conclusions.

Mathematics already contains algorithms: column addition, long division, finding common factors by systematic search, checking divisibility, or converting a mixed number. The important habit is not memorising arrows; it is stating exactly what information is checked, what action follows and when the process stops.

This guide is Primary Mathematics enrichment connecting Systematic Listing, Logic, Deduction and Truth Conditions, and Function Machines. Formal programming notation is unnecessary. Use the MOE Primary curriculum page and current school scope for required content.

What makes an algorithm · Sequence · Decision branches · Repeated steps · Correctness and stopping · Efficiency · 24 questions · Worked answers

1. A good algorithm is finite, ordered and unambiguous

“Do some division until it looks right” is not a precise algorithm. “Divide the total by the number of equal groups, then multiply the quotient by the group count to check the total” is much clearer.

Worked example A: Compare two numbers

Input two numbers a and b. Step 1: if a>b, report a. Step 2: otherwise, if b>a, report b. Step 3: otherwise, report “equal.” All possible comparisons are covered.

Worked example B: Even or odd

Divide a whole number by two. If the remainder is zero, report even. If the remainder is one, report odd. For non-negative whole numbers, those are the only possible remainders.

Worked example C: Missing branch

A procedure says: if x>0 report positive; otherwise report negative. Input zero is misclassified. The corrected procedure needs a separate equality case or an “otherwise report non-positive” conclusion with appropriate wording.

2. Sequence means later steps use the results of earlier steps

To convert 3 m 45 cm entirely to centimetres, first convert three metres to 300 cm, then add 45 cm. Reversing the steps without tracking units can create an invalid total.

Worked example D: Mean of four values

Algorithm: add the four values; divide the total by four; report the result. For 5,7,8,12 the sum is 32 and mean is 8.

Worked example E: Fraction of a quantity

To find 3/5 of forty: divide forty into five equal parts to get eight; take three parts, giving 24. The sequence records unit meaning.

Worked example F: Reverse sequence

A forward process adds six then doubles. To recover an input from an output, halve first then subtract six. This is an inverse algorithm built from reverse operations.

3. Decision branches separate cases that need different actions

A branch asks a yes/no or multi-way question. The question must be discriminating: different answers should lead to genuinely different next steps.

Worked example G: Divisibility by 6

A whole number is divisible by six when it is divisible by both two and three. Decision route: first test evenness; if false, stop “not divisible by 6.” If true, test divisibility by three. Only if both pass report “divisible by 6.”

Worked example H: Classify triangle by side equality

If all three sides are equal, equilateral. Otherwise if exactly two are equal, isosceles. Otherwise, scalene. The order prevents an equilateral triangle from being stopped at the weaker statement “at least two sides equal.”

Worked example I: Positive whole-number comparison

Given x, report “small” if x<10, “medium” if 10≤x≤20, and “large” if x>20. Boundary values ten and twenty must be routed intentionally.

Worked example J: Eligibility algorithm

A candidate integer n is accepted only if 5≤n≤20 and n is even. Check the range first, then parity. Input fourteen passes both; input twenty-two fails range immediately.

4. Repetition handles a collection without rewriting the same step

To sum the numbers one through five by repeated addition: start total at zero; add the next number; continue until five has been added; report fifteen. The loop needs a clear starting value, update rule and stopping condition.

Worked example K: Count factors

To list factors of twelve: test each positive whole number from one through twelve; keep those dividing twelve exactly. The result is 1,2,3,4,6,12.

Worked example L: Search a finite range

Find whole numbers from one to thirty divisible by four and six. Test multiples of twelve or test every candidate against both conditions. The valid values are 12 and 24.

Worked example M: Repeated subtraction as division

To compute 23÷5 using repeated subtraction, subtract five while at least five remains. Four subtractions leave three. Quotient four, remainder three.

Stopping matters

A loop “add one forever” has no terminating condition and is not a finite algorithm for a completed school calculation. “Repeat until the total reaches or exceeds twenty” does terminate under positive additions.

5. Correctness means every permitted input is handled appropriately

Testing one example can reveal an error but cannot prove a general algorithm correct. For a finite small domain, exhaustive checking may be possible. For a wider domain, explain why each branch or step preserves the intended relationship.

Worked example N: Divisibility decision tree

A rule for divisibility by ten says “last digit zero.” This covers every whole number because place value decomposes the number into tens plus its units digit. A single example such as 120 supports the rule but is not the general reason.

Worked example O: Boundary failure

A flowchart labels x<10 as low and x>10 as high but has no route for x=10. Boundary tests are powerful because they target gaps between branches.

Worked example P: Impossible instruction

A step says “choose the larger of a and b” when a=b. The procedure must define what happens on equality if later steps need one named choice.

6. Different correct algorithms can use different amounts of work

To find whether 997 is divisible by two, checking the last digit is faster than performing full long division, although both can be correct. Efficiency matters after correctness.

Worked example Q: Common multiples

To find the first positive number divisible by four and six, testing every positive integer eventually finds twelve. Listing multiples of the larger structure or using LCM reasoning reaches 12 more efficiently.

Worked example R: Search direction

To find the largest multiple of seven not exceeding one hundred, count down from 100 until divisibility works or compute 14×7=98. Both are correct; the structured multiplication route is shorter.

Worked example S: Early stopping

When checking whether an integer is divisible by six, failing the even test already settles the answer. There is no need to test divisibility by three after that if the objective is only the yes/no result.

7. Practice: 24 original questions

Questions 1–8: Sequence and branching

1. A procedure compares a and b. For a=7,b=4, which value should be reported as larger?

2. Use remainder on division by 2 to classify 27 as even or odd.

3. A flowchart says “if x>0 positive, otherwise negative.” What input exposes the missing case?

4. Find the mean of 5,7,8,12 using the sequence add then divide by four.

5. Find 3/5 of 40 using equal-part steps.

6. Forward process: +6 then ×2. Output is 30. Recover the input.

7. Is 42 divisible by 6? Use the tests divisible by 2 and by 3.

8. Classify side lengths 6,6,6 as equilateral, isosceles or scalene using the decision order in this guide.

Questions 9–16: Repetition and finite search

9. Classify x=10 under: low if x<10, medium if 10≤x≤20, large if x>20.

10. Does integer n=14 pass the rule 5≤n≤20 and even?

11. List all factors of 12 using systematic testing.

12. List whole numbers 1–30 divisible by both 4 and 6.

13. Use repeated subtraction to find 23÷5 as quotient and remainder.

14. A loop starts total=0 and repeatedly adds 3 until total≥15. How many additions occur?

15. A loop starts n=1 and doubles n until n≥20. List the successive stored values.

16. Why is “repeat add one forever” not a finite algorithm for a completed calculation?

Questions 17–24: Correctness and efficiency

17. A flowchart has x<10 and x>10 branches only. Which boundary input is unhandled?

18. Find the first positive whole number divisible by both 4 and 6.

19. Find the largest multiple of 7 not exceeding 100.

20. A divisibility-by-6 algorithm tests evenness first. If the number is odd, can it stop immediately? Explain.

21. A number’s last digit is zero. What can the algorithm conclude about divisibility by 10?

22. A procedure chooses the larger of a and b but gives no equality rule. What input pair exposes the ambiguity?

23. Compare two methods for deciding whether 997 is even: full division by 2 or checking the last digit. Which uses less work?

24. Design the branch conditions for accepting an integer only when 3<n≤9 and n is odd. List all accepted integer inputs.

8. Worked answers

Answers 1–8

1. 7. Seven is greater than four.

2. Odd. 27÷2 leaves remainder one.

3. x=0. Zero is neither positive nor negative.

4. 8. Sum 32, then 32÷4.

5. 24. Forty÷5=8, then 8×3.

6. 9. Undo ×2: 30÷2=15; undo +6: 15−6=9.

7. Yes. Forty-two is even and its digit sum 6 is divisible by three.

8. Equilateral. All three sides are equal.

Answers 9–16

9. Medium. Ten is included in 10≤x≤20.

10. Yes. Fourteen lies in the range and is even.

11. 1,2,3,4,6,12.

12. 12,24. These are the multiples of twelve within the range.

13. Quotient 4, remainder 3. Subtract five four times.

14. 5 additions. Totals are 3,6,9,12,15.

15. 1,2,4,8,16,32. The process stops after reaching a value at least twenty.

16. It has no stopping condition. The process never reaches a final reported state.

Answers 17–24

17. x=10.

18. 12. It is the least common multiple of four and six.

19. 98. Fourteen times seven.

20. Yes. A number divisible by six must be even, so an odd input already fails a necessary condition.

21. It is divisible by 10. Whole numbers ending in zero are multiples of ten.

22. Any equal pair, for example a=5,b=5.

23. Checking the last digit. Seven is odd, so 997 is odd without full division.

24. Require 3<n≤9 and odd. Accepted inputs: 5,7,9.

9. Teaching and transfer

If a learner writes vague steps, ask whether another person could follow them without guessing. Ambiguity becomes visible when two reasonable interpretations produce different results.

Trace before trusting

Run a small input through every step and record the intermediate state. Tracing catches skipped operations and branch mistakes before the procedure is generalised.

Test boundaries and special cases

For a range branch, test the exact boundary. For comparison, test equality. For division, test zero where allowed. These cases often reveal missing arrows faster than random examples.

Separate correctness from efficiency

A long algorithm can be correct. Improve it only after every input is handled properly. This connects to Optimisation, Minimum Moves and Efficient Constructions.

Connect branches to inequalities

Decision conditions such as 3<n≤9 define feasible input regions. The Inequalities guide makes those regions explicit.

Continue through this enrichment collection

For reversible arithmetic rules, use Function Machines, Input–Output Tables and Inverse Rules. For feasible branch conditions, use Inequalities, Number Lines and Feasible Ranges. For spatial decision regions, use Loci, Distance Constraints and Grid Geometry.

Return to the BTT Primary Mathematics Learning Hub.

Original enrichment guide with 24 original practice questions and separate worked answers. Flowcharts and decision trees are mathematical procedure models; no programming platform is required.