[Lintcode]给一组整数,按照升序排序,插入排序java实现

public class Solution
{
    /*
     * @param A: an integer array
     * @return: 
     */
    public void sortIntegers(int[] A) 
    {
        // write your code here
        int temp;
        for(int i = 1; i < A.length; i++)
        {  
        for(int j = i; (j > 0) && (A[j] < A[j-1]); j--) 
            {  
            temp=A[j-1];
            A[j-1]=A[j];
            A[j]=temp;
            }  
         }  
    }
   
}

你可能感兴趣的:([Lintcode]给一组整数,按照升序排序,插入排序java实现)