Activity 01
Pair Programming: Linear Search Code-Off
Pairs write a linear search function in Python and test it on unsorted lists of 10, 100, and 1,000 items. They time runs using time module and graph results. Discuss findings: why does time grow linearly?
Compare the efficiency of linear search versus binary search for sorted data.
Facilitation TipDuring the Pair Programming Linear Search Code-Off, circulate and ask each pair to verbalize the loop condition and comparison before running the code to reinforce trace skills.
What to look forPresent students with a small, unsorted list of numbers and a target value. Ask them to trace the steps of a linear search to find the target, noting how many comparisons are made. Then, ask them to explain why binary search would not be applicable here.