using System;
public class ShellSorter
{
  public void Sort(int [] list)
  {
      int inc;
      for(inc=1;inc<=list.Length/9;inc=3*inc+1);
      for(;inc>0;inc/=3)
      {
          for(int i=inc+1;i<=list.Length;i+=inc)
        {
          int t=list[i-1];
          int j=i;
          while((j>inc)&&(list[j-inc-1]>t))
          {
            list[j-1]=list[j-inc-1];
            j-=inc;
          }
          list[j-1]=t;
        }
      }
    }
}
public class MainClass
{
    public static void Main()
    {
    int[] iArrary=new int[]{1,5,3,6,10,55,9,2,87,12,34,75,33,47};
    ShellSorter sh=new ShellSorter();
    sh.Sort(iArrary);
    for(int m=0;m<=13;m++)
    Console.WriteLine("{0}",iArrary[m]); 
      }
}
已经编译通过.

相关文章:

  • 2021-08-16
  • 2021-11-02
  • 2022-03-03
  • 2021-10-24
  • 2022-01-26
  • 2022-03-11
  • 2022-01-30
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-08-19
  • 2022-01-05
  • 2021-06-14
  • 2021-07-13
相关资源
相似解决方案