We introduce the linear search, binary search, and insertion sort algorithms. Linear search can be used to search for the first occurence of an item in a list. Use binary search when you are searching through a sorted list. Insertion sort is one of several well known algorithms for sorting (and we'll discuss another one next lecture). You can think of these algorithms as demonstrations of the use (and usefulness) of while loops. If you will take the next programming course (CS 2110) later, you will learn much more about the algorithms, different implementations, and analysis.

Lecture Prep

The pre-lecture activity is actually the post-lecture activity of Lec 24 on subclassing. Be sure to try it yourself before you read our implementation now posted with the rest of the Lecture 24 materials.


Lecture materials

Slides: individual slides for viewing , 6-up layout for printing

Examples:

Link to Lecture Recording