Skip to content

Sorting Algorithms: Selection and Bubble SortActivities & Teaching Strategies

Active learning lets students experience sorting algorithms step by step, which builds intuition for abstract processes. By moving cards, tracing code, and racing outputs, students connect the algorithmic rules to the outcomes they produce, making these foundational concepts stick.

Grade 11Computer Science4 activities20 min35 min

Learning Objectives

  1. 1Compare the number of comparisons and swaps required by selection sort and bubble sort for a given unsorted list.
  2. 2Explain the step-by-step process of selection sort by tracing its execution on a small array.
  3. 3Explain the step-by-step process of bubble sort by tracing its execution on a small array.
  4. 4Critique the time complexity of selection sort and bubble sort, identifying scenarios where each might be marginally preferable.
  5. 5Implement selection sort and bubble sort algorithms in a programming language.

Want a complete lesson plan with these objectives? Generate a Mission

30 min·Pairs

Pair Programming: Implement Selection Sort

Pairs write pseudocode first, then code selection sort in Python or JavaScript. Test on arrays of 5-10 elements, printing array states after each pass. Discuss swaps observed.

Prepare & details

Compare the efficiency of selection sort and bubble sort for small datasets.

Facilitation Tip: During Pair Programming: Implement Selection Sort, circulate and ask pairs to explain their swap conditions aloud to catch logic errors early.

Setup: Varies; may include outdoor space, lab, or community setting

Materials: Experience setup materials, Reflection journal with prompts, Observation worksheet, Connection-to-content framework

ApplyAnalyzeEvaluateSelf-AwarenessSelf-ManagementSocial Awareness
25 min·Small Groups

Small Groups: Bubble Sort Card Sort

Distribute shuffled number cards to groups of 4. Perform bubble sort passes aloud, swapping as needed and recording passes on chart paper. Compare to selection sort on same set.

Prepare & details

Explain the mechanism by which bubble sort moves elements to their correct positions.

Facilitation Tip: In Small Groups: Bubble Sort Card Sort, limit each pass to 30 seconds to force students to focus on the comparison-swap cycle.

Setup: Varies; may include outdoor space, lab, or community setting

Materials: Experience setup materials, Reflection journal with prompts, Observation worksheet, Connection-to-content framework

ApplyAnalyzeEvaluateSelf-AwarenessSelf-ManagementSocial Awareness
35 min·Whole Class

Whole Class: Efficiency Race

Project two implementations; input growing arrays and time runs live. Class votes on winner per size, plots results to graph time vs. n. Debrief patterns.

Prepare & details

Critique the practical applicability of these basic sorting algorithms in real-world scenarios.

Facilitation Tip: During Efficiency Race, provide a stopwatch so students time their runs and record swaps to develop a habit of measuring performance.

Setup: Varies; may include outdoor space, lab, or community setting

Materials: Experience setup materials, Reflection journal with prompts, Observation worksheet, Connection-to-content framework

ApplyAnalyzeEvaluateSelf-AwarenessSelf-ManagementSocial Awareness
20 min·Individual

Individual: Trace and Visualize

Students trace bubble sort on paper for given array, drawing swaps. Use online visualizer to verify, note optimized early-stop version.

Prepare & details

Compare the efficiency of selection sort and bubble sort for small datasets.

Facilitation Tip: During Trace and Visualize, require students to label each step with the algorithm’s invariant to reinforce correctness.

Setup: Varies; may include outdoor space, lab, or community setting

Materials: Experience setup materials, Reflection journal with prompts, Observation worksheet, Connection-to-content framework

ApplyAnalyzeEvaluateSelf-AwarenessSelf-ManagementSocial Awareness

Teaching This Topic

Teach these algorithms by starting with physical models before code. Students need to see why a swap happens, not just that it does. Avoid rushing to optimization; emphasize the cost of each comparison and swap. Research shows that tracing on paper first reduces errors when students later implement the same logic in code.

What to Expect

Students will confidently trace the steps of both algorithms on paper and in code, explain why each pass occurs, and discuss the efficiency trade-offs between them. They will also recognize that neither algorithm scales well, preparing them for more advanced sorts.

These activities are a starting point. A full mission is the experience.

  • Complete facilitation script with teacher dialogue
  • Printable student materials, ready for class
  • Differentiation strategies for every learner
Generate a Mission

Watch Out for These Misconceptions

Common MisconceptionDuring Pair Programming: Implement Selection Sort, some students assume the algorithm always needs n passes regardless of data order.

What to Teach Instead

After the first implementation, ask pairs to test on a nearly-sorted list and compare pass counts to their initial assumption.

Common MisconceptionDuring Small Groups: Bubble Sort Card Sort, students believe bubble sort stops after a single pass if no swaps occur.

What to Teach Instead

During the activity, have groups rerun the pass until no swaps happen, then count the total passes to correct this idea.

Common MisconceptionDuring Efficiency Race, students think selection sort is always slower because it does more swaps.

What to Teach Instead

During the race, display real-time swap and comparison counts so students see selection sort’s O(n) swaps versus bubble sort’s O(n²) swaps in worst case.

Assessment Ideas

Quick Check

After Small Groups: Bubble Sort Card Sort, provide a small, unsorted array (e.g., [5, 1, 4, 2]). Ask students to manually perform one pass of bubble sort, write the array’s state, and count swaps to check their understanding of the comparison-swap cycle.

Discussion Prompt

During Efficiency Race, pose the question: 'Imagine you have a list of 10 student scores to sort from highest to lowest. Which algorithm, selection sort or bubble sort, do you think would be more efficient, and why?' Guide students to discuss the number of comparisons and swaps, then vote and tally responses to surface misconceptions.

Exit Ticket

After Trace and Visualize, ask students to write down the primary difference in how selection sort and bubble sort find and place elements in their correct positions, using their traced examples to support their answers.

Extensions & Scaffolding

  • Challenge: Ask students to implement an early-exit condition in bubble sort and explain how it affects the best-case runtime.
  • Scaffolding: Provide partially completed code for selection sort with comments guiding the next step.
  • Deeper exploration: Have students research insertion sort and compare its steps to bubble and selection sorts, noting where comparisons overlap.

Key Vocabulary

Selection SortA sorting algorithm that repeatedly selects the smallest (or largest) element from the unsorted portion of the list and puts it at the beginning.
Bubble SortA simple sorting algorithm that repeatedly steps through the list, compares adjacent elements and swaps them if they are in the wrong order.
In-place sortingA sorting algorithm that sorts an array by modifying it directly, without requiring significant additional memory space.
Time ComplexityA measure of how the runtime of an algorithm grows as the input size increases, often expressed using Big O notation.
ComparisonAn operation in a sorting algorithm where two elements are checked to determine their relative order.
SwapAn operation in a sorting algorithm where the positions of two elements in the list are exchanged.

Ready to teach Sorting Algorithms: Selection and Bubble Sort?

Generate a full mission with everything you need

Generate a Mission