AP Computer Science A · Lesson 4.15 · Unit 4 · CED topic 4.14

Linear search

Name:   Date:  

1 Why this lesson matters

Read the opening paragraph and the "Required content" box on the lesson page. In your own words, explain each objective below.

14.A. Develop code used for linear search algorithms to search for specific information in a collection and determine the results of executing a search.

2 The algorithm

Read this section. In your own words, summarize the main idea.

3 Searching a list or Strings

Read this section. In your own words, summarize the main idea.

4 Searching a 2D array

Read this section. In your own words, summarize the main idea.

5 How many steps?

Read this section. In your own words, summarize the main idea.

6 Worked example

Read the "Worked example" box. Then, without looking back, try writing your own answer below.

How many elements does a linear search for each target look at in {4, 8, 15, 16, 23, 42}?

7 Exam focus: avoid this mistake

Read the "Exam focus" box, then restate it in your own words.

8 Sum it up

In two or three sentences, explain this lesson's main idea to someone who has not read it.