Skip over navigation

Contents

Insertion Sort

Insertion Sort Problems

The Insertion Sort Algorithm

How to Cite This SparkNote

Problem : What is the best case efficiency for insertion sort?

The best case efficiency is O(n) . It occurs when the data is in sorted order. After making one pass through the data and making no insertions, insertion sort exits.

Problem : What is the worst case efficiency of insertion sort? When does it occur?

The worst case efficiency is O(n 2) . The worst case occurs when the data is in reverse order.

Problem : Show the steps in sorting the following list using insertion sort: (4, 6, 2, 3, 9).

(4, 6, 2, 3, 9). (2, 4, 6, 3, 9). (2, 3, 4, 6, 9).

Problem : What kind of data structure might make insertion sort particularly inefficient?

A data structure for which shifting data is not efficient.

Follow Us