- aop.zip
- antlr.runtime.dll
- Benchmarking.sln
- Benchmarking
- Client
- CommandUI
- Common.Logging.dll
- Core
- MyApplication.CommandClient
- MyApplication.CommandCore
- Sorting
- Spring.Aop.dll
- Spring.Core.dll
|
//This is an unedited source code from:
//http://www.codeproject.com/cs/algorithms/cssorters.asp
//Article content copyright Jonathan de Halleux, Marc Clifton, Robert Rohde, 2004
//everything else Copyright � CodeProject, 1999-2007.
using System;
using System.Collections;
namespace NSort
{
public class InsertionSort : SwapSorter
{
public InsertionSort() : base() {}
public InsertionSort(IComparer comparer, ISwap swapper)
: base(comparer,swapper)
{}
public override void Sort(IList list)
{
int i;
int j;
object b;
for (i=1; i<list.Count ;i++)
{
j=i;
b = list[i];
while ((j > 0) && (Comparer.Compare(list[j-1], b)>0))
{
Swapper.Set(list, j, list[j-1]);
--j;
}
Swapper.Set(list, j, b);
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.