Assembly: AsproSort (in AsproSort.dll) Version: 1.0.0.0 (1.0.3.68)
Syntax
| C# |
|---|
public static class InsertionSort |
| Visual Basic (Declaration) |
|---|
Public NotInheritable Class InsertionSort |
| Visual C++ |
|---|
public ref class InsertionSort abstract sealed |
Remarks
Insertion sort is an in-place, stable sort algorithm. It struggles with a best, worst and average case complexity of O(n²) as well as small constant auxiliary storage requirements.
This very poor time complexity would normally mean that Insertion sort would never be used except in naive implementations where algorithmic complexity is not properly understood. But, in fact, for very small n the overhead involved in many divide and conquer algorithms (i.e. Quicksort, Mergesort, etc.) outweighs the complexity of Insertion sort. For this reason many divide and conquer algorithms switch to Insertion sort when the size of the data to be sorted is small.
For further information a good starting place is the Wikipedia Insertion sort page.