C#实现插入排序算法

public class InsertionSorter    
{    
    
public void Sort(int[] arr)    
    {    
        
for (int i = 1; i < arr.Length; i++)    
        {    
            
int t = arr[i];    
            
int j = i;    
            
while ((j > 0&& (arr[j - 1> t))    
            {    
                arr[j] 
= arr[j - 1];//交换顺序    
                --j;    
            }    
            arr[j] 
= t;    
        }    
    }  
   
}   

freedom -
共有0个回答