惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
SegmentFault 最新的问题
B
Blog
P
Proofpoint News Feed
美团技术团队
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
A
About on SuperTechFans
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Vercel News
Vercel News
有赞技术团队
有赞技术团队
小众软件
小众软件
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Google DeepMind News
Google DeepMind News
Martin Fowler
Martin Fowler
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
aimingoo的专栏
aimingoo的专栏
H
Help Net Security
罗磊的独立博客
L
LangChain Blog
GbyAI
GbyAI
腾讯CDC
T
The Blog of Author Tim Ferriss
Microsoft Security Blog
Microsoft Security Blog

博客园 - 阿伟

转一个哥们的日记看了让你吐血 IT技术和职位小览和应聘注意事项 生活中的笑话 男人25岁前的忠告(转) 经典承诺 怎样对待男人和女人之间关系 快速排序(c#) 如何关闭常见端口(113、4899、389、6129等端口) 一些字符串操作的常用用法 - 阿伟 - 博客园 选择排序(C#) C#常用函数 几个网络术语!~ net命令研究 股票术语集锦 找女朋友的标准,男人不看后悔一辈子!!! DataGrid自定义分页存储过程 男生给女生最牛B的告白 一个光棍的呐喊! 令人呕吐的几则笑话^_^
插入排序(C#)
阿伟 · 2006-03-04 · via 博客园 - 阿伟

using System;
public class InsertionSorter
{
  
public void Sort(int [] list)
  
{
      
for(int i=1;i<list.Length;++i)
      
{
          
int t=list[i];
          
int j=i;
          
while((j>0)&&(list[j-1]>t))
          
{
            list[j]
=list[j-1];
            
--j;
          }

        list[j]
=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};
    InsertionSorter ii
=new InsertionSorter();
    ii.Sort(iArrary);
    
for(int m=0;m<=13;m++)
    Console.WriteLine(
"{0}",iArrary[m]);  
      }

}