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

Insertion sort

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.

15.A. Determine the result of executing each step of sorting algorithms to sort the elements of a collection.

2 The idea

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

3 The code

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

4 Tracing the passes

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

5 Best and worst case

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

6 On an ArrayList

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

7 Worked example

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

Trace {4, 8, 3, 1, 6} and give the array after two passes of insertion sort, then compare with selection sort.

8 Exam focus: avoid this mistake

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

9 Sum it up

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