Activity 01
Pair Programming: Code Bubble Sort
Pairs write a Python function for bubble sort, test it on small arrays, and print swap counts. They then modify code to handle duplicates and optimise the last pass check. Pairs share one insight with the class.
Explain the mechanism of the bubble sort algorithm.
Facilitation TipDuring Pair Programming, encourage students to take turns explaining each swap aloud to reinforce logical flow and catch errors early.
What to look forPresent students with a small unsorted array (e.g., [5, 1, 4, 2]). Ask them to trace the first pass of bubble sort, showing the array's state after each swap and identifying the largest element that has 'bubbled' to its correct position.