CS 105

Week 6

Midterm 1

Midterm 1 is Tuesday, March 3rd, 8:00pm-9:30pm

Tomorrow!

Midterm 1

25-35 multiple choice questions
2-4 free response questions

Searching

Searching

One task that is common for many programs is searching for data.

Google: Search for a website

Facebook/Instagram/Twitter: Search for a friend

Netflix: Search for a TV show

Search Examples

Example 1

Example 2

Linear Search

A linear search starts with the first element in a list and examines every element until it is found (or not found).

Lets program one!

Binary Search

A binary search tries to cut each element in half every time.

Data must be sorted!

Binary Search

1, 10, 22, 34, 54

Lets program one!