File size: 350 Bytes
bff4ec7
 
 
 
3805fe5
bff4ec7
 
 
3805fe5
bff4ec7
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
int* sortArray(int* nums, int numsSize, int* returnSize) 

{
    *returnSize = numsSize;
    
    for (int i = 1; i < numsSize; ++i) {
        int key = nums[i];
        int j = i - 1;
        
        while (j >= 0 && nums[j] > key) {
            nums[j + 1] = nums[j];
            j--;
        }
        nums[j + 1] = key;
    }
    return nums;
}