Skip to content
Computing · Secondary 4

Active learning ideas

Introduction to Sorting Algorithms: Bubble Sort

Active learning works because bubble sort’s step-by-step swapping of adjacent elements mirrors hands-on actions students can physically perform. Tracing small arrays on paper or with cards lets students see how passes push larger values to the end, making the abstract algorithm concrete and memorable.

MOE Syllabus OutcomesMOE: Algorithms - S4
20–45 minPairs → Whole Class4 activities

Activity 01

Simulation Game30 min · Pairs

Pair Tracing: Card Swaps

Pairs receive printed cards with array values like [7, 2, 9, 4]. They perform bubble sort passes by swapping adjacent cards aloud, recording swaps per pass on worksheets. Pairs then trace a second array and compare results with neighbors.

Explain the step-by-step process of the bubble sort algorithm.

Facilitation TipDuring Pair Tracing: Card Swaps, circulate and ask each pair to verbalize their reasoning after each swap to ensure they connect the physical action to the algorithm’s logic.

What to look forPresent students with a small, unsorted array, e.g., [7, 1, 5, 3]. Ask them to trace the first pass of bubble sort, showing each comparison and swap, and then state the array's state after the first pass.

ApplyAnalyzeEvaluateCreateSocial AwarenessDecision-Making
Generate Complete Lesson

Activity 02

Simulation Game45 min · Small Groups

Small Groups: Efficiency Timer

Groups sort three arrays (random, nearly sorted, reverse) using physical cards or pseudocode. They count comparisons and time each, then graph results to spot patterns. Discuss why random data takes longest.

Analyze the efficiency of bubble sort for nearly sorted versus randomly ordered data.

Facilitation TipDuring Efficiency Timer, have groups record their times on a shared board so the whole class sees the quadratic pattern emerging as array sizes grow.

What to look forPose the question: 'If you had an array with 100 elements that was already sorted, how many comparisons would bubble sort perform? What if it was in reverse order? Explain your reasoning.'

ApplyAnalyzeEvaluateCreateSocial AwarenessDecision-Making
Generate Complete Lesson

Activity 03

Simulation Game25 min · Whole Class

Whole Class: Prediction Board

Display an array on the board. Class predicts total comparisons before tracing bubble sort together, marking swaps live. Reveal actual count and adjust predictions for larger arrays.

Predict the number of comparisons required for a given array size using bubble sort.

Facilitation TipDuring Prediction Board, pause after each prediction round to ask students to justify their answers using terms like ‘passes’ and ‘adjacent comparisons’ to reinforce correct vocabulary.

What to look forGive students an array like [2, 8, 1, 9, 4]. Ask them to write down the number of passes bubble sort would complete if early termination is *not* used, and then identify the element that is guaranteed to be in its final sorted position after the first pass.

ApplyAnalyzeEvaluateCreateSocial AwarenessDecision-Making
Generate Complete Lesson

Activity 04

Simulation Game20 min · Individual

Individual: Code Tracer

Students trace provided bubble sort pseudocode on worksheets for two arrays, one optimized. They note pass counts and identify limitations, then self-check against answer keys.

Explain the step-by-step process of the bubble sort algorithm.

Facilitation TipDuring Code Tracer, provide a color-coded key for the swap steps so students can visually track how the unsorted portion shrinks with each pass.

What to look forPresent students with a small, unsorted array, e.g., [7, 1, 5, 3]. Ask them to trace the first pass of bubble sort, showing each comparison and swap, and then state the array's state after the first pass.

ApplyAnalyzeEvaluateCreateSocial AwarenessDecision-Making
Generate Complete Lesson

A few notes on teaching this unit

Teach bubble sort by starting with physical swaps before moving to pseudocode, because kinesthetic learning builds accurate mental models. Avoid rushing to the code; let students feel the inefficiency of multiple passes first. Research shows that tracing small arrays by hand reduces errors when students later read or write the algorithm.

By the end of these activities, students will accurately trace bubble sort passes on small arrays, explain why early termination stops the algorithm early, and quantify the difference between one pass and a full sort. Their language will reflect adjacent comparisons and pass counts.


Watch Out for These Misconceptions

  • During Pair Tracing: Card Swaps, watch for students attempting to swap non-adjacent cards or moving more than one card per comparison.

    Have students physically attempt non-adjacent swaps with their cards and observe how the array fails to progress toward order, then redirect them to compare only adjacent pairs and explain why larger jumps break the logic.

  • During Whole Class: Prediction Board, watch for students assuming the array will be sorted after a single pass.

    Pause the activity after the first prediction round to trace the first pass step-by-step on the board, marking which elements are now in place, and ask the class to explain why remaining elements still need sorting.

  • During Efficiency Timer, watch for students assuming bubble sort performs equally well on large arrays as on small ones.

    After timing the races, ask groups to graph their data and compare the time growth between array sizes, then ask them to explain why the line curves upward instead of growing linearly.


Methods used in this brief