C++_直接插入排序

void issort2(int a[],int n)
{
	int temp=0;
	int i=0,j=0;
	for(i=1;i<n;i++)
	{
		
		temp=a[i];
		j=i-1;
		while(j>=0 && a[j]>temp)
		{
			a[j+1]=a[j];
			j--;
		}
		a[j+1]=temp;

	}
}

posted @ 2013-08-09 00:56  MrMrCash  阅读(170)  评论(0编辑  收藏  举报