Activity 01
Pair Programming: Binary Search Function
Pairs write a Python function for binary search on a sorted list, including input validation for sorted data. They test with sample lists and edge cases like absent targets. Pairs swap code to debug and time executions against linear search.
Differentiate between linear search and binary search in terms of prerequisites and performance.
Facilitation TipDuring Pair Programming, insist each partner writes comments for every line before coding so both understand the logic flow.
What to look forPresent students with a sorted list of numbers and a target value. Ask them to trace the steps of a binary search on paper, showing the 'low', 'high', and 'mid' pointers at each iteration until the target is found or the search space is exhausted.