straightinsertionsorter.cs
来自「Data Structures and Algorithms with Obj」· CS 代码 · 共 27 行
CS
27 行
namespace Opus6
{
using System;
[Version("$Id: StraightInsertionSorter.cs,v 1.3 2001/09/11 12:04:04 brpreiss Exp $"), Copyright("Copyright (c) 2001 by Bruno R. Preiss, P.Eng.")]
public class StraightInsertionSorter : AbstractSorter
{
public static void Main()
{
AbstractSorter.TestSorter(new StraightInsertionSorter(), 0x3e8, 0x7b);
}
protected override void Sort()
{
for (int num1 = 1; num1 < base.n; num1++)
{
for (int num2 = num1; (num2 > 0) && (base.array[num2 - 1] > base.array[num2]); num2--)
{
this.Swap(num2, num2 - 1);
}
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?