Lab 1: Search Algorithms and Efficiency

In a reversal of their Unit 2 number guessing game, students design an algorithm that identifies the player's secret number by: guessing, asking the player if the guesses are too high or too low, and guessing again until guessing right. Students use this as a basis for developing and analyzing list searching algorithms for ordered and unordered lists.

An efficient list searching algorithm depends on the fact that numbers have order. Searching an ordered list to find the location of a given object is most efficiently done with essentially the same algorithm. Searching for the location of an object in an unordered list cannot be done the same way. The time that it takes these two algorithms to find their objects hardly matters when the lists are small, but matters a lot when the lists get large. This is students' first experience analyzing computational complexity.

From Dan:

This is a great introduction to concurrent algorithms, and allows the kids to come up with algorithms on their own, and builds team spirit. It's really fun and useful to plot the fastest times vs the number of players, and talk about Amdahl's law. (Added in by MF) Brian suggested the placement in the middle of Lab 3.

From L3:

Students compare and contrast algorithms based on their code and running times. Students write a program that times a computation in milliseconds and then time several processes and compare the results. Students also learn the differences between algorithms that run in reasonable time and algorithms that do not. Algorithms that run in reasonable time are further divided into constant time processes (ones in which computing time is not affected by the magnitude of the input), linear time (computing time proportional to the magnitude of the input), and polynomial time (slower than linear, computing time proportional to some polynomial function of the input).

Pacing:

The 7 required lab pages could be split across 4–7 days (150–300 minutes). Expected times to complete follow:

Lab Pages

Solutions

Correlation with 2020 AP CS Principles Framework 

Computational Thinking Practices: Skills

Learning Objectives:

Essential Knowledge: