Insertion Sort - Algorithm Introduction

This section describes the Insertion Sort algorithm - A simple and slow sorting algorithm that repeatedly takes the next element from the un-sorted section and inserts it into the sorted section at the correct position.

Insertion Sort is a simple and slow sorting algorithm that repeatedly takes the next element from the un-sorted section and inserts it into the sorted section at the correct position.

The basic idea of Insertion Sort algorithm can be described as these steps:

1. Data elements are grouped into two sections: a sorted section and an un-sorted section.

2. Take an element from the un-sorted section.

3. Insert the element into the sorted section at the correct position based on the comparable property.

4. Repeat step 2 and 3 until no more elements left in the un-sorted section.

The idea of insertion sort comes from our daily life experiences. For example, when you play cards with your friends, you will insert the next card you pick into the sorted cards in your hand.

Last update: 2011.

Table of Contents

 About This Book

 Introduction of Sorting Algorithms

 Java API for Sorting Algorithms

Insertion Sort Algorithm and Implementation

Insertion Sort - Algorithm Introduction

 Insertion Sort - Java Implementation

 Insertion Sort - Performance

 Insertion Sort - Implementation Improvements

 Selection Sort Algorithm and Implementation

 Bubble Sort Algorithm and Implementation

 Quicksort Algorithm and Implementation

 Merge Sort Algorithm and Implementation

 Heap Sort Algorithm and Implementation

 Shell Sort Algorithm and Implementation

 Performance Summary of Java Implementations

 References

 PDF Printing Version